<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">-- | Provides the heuristics for when it's beneficial to lambda lift bindings.</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Most significantly, this employs a cost model to estimate impact on heap</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- allocations, by looking at an STG expression's 'Skeleton'.</span><span>
</span><span id="line-8"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Stg.Lift.Analysis</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-9"></span><span>    </span><span class="annot"><span class="hs-comment">-- * #when# When to lift</span></span><span>
</span><span id="line-10"></span><span>    </span><span class="annot"><span class="hs-comment">-- $when</span></span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span>    </span><span class="annot"><span class="hs-comment">-- * #clogro# Estimating closure growth</span></span><span>
</span><span id="line-13"></span><span>    </span><span class="annot"><span class="hs-comment">-- $clogro</span></span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span>    </span><span class="annot"><span class="hs-comment">-- * AST annotation</span></span><span>
</span><span id="line-16"></span><span>    </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier">Skeleton</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BinderInfo"><span class="hs-identifier">BinderInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier">binderInfoBndr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>    </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgBinding"><span class="hs-identifier">LlStgBinding</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgExpr"><span class="hs-identifier">LlStgExpr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgRhs"><span class="hs-identifier">LlStgRhs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgAlt"><span class="hs-identifier">LlStgAlt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonTopBind"><span class="hs-identifier">tagSkeletonTopBind</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Lifting decision</span></span><span>
</span><span id="line-19"></span><span>    </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#goodToLift"><span class="hs-identifier">goodToLift</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>    </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#closureGrowth"><span class="hs-identifier">closureGrowth</span></a></span><span> </span><span class="hs-comment">-- Exported just for the docs</span><span>
</span><span id="line-21"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html"><span class="hs-identifier">GHC.Types.Demand</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html"><span class="hs-identifier">GHC.Runtime.Heap.Layout</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier">WordOff</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html"><span class="hs-identifier">GHC.Stg.Syntax</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html"><span class="hs-identifier">GHC.StgToCmm.ArgRep</span></a></span><span>  </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">StgToCmm.ArgRep</span></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Closure.html"><span class="hs-identifier">GHC.StgToCmm.Closure</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">StgToCmm.Closure</span></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Layout.html"><span class="hs-identifier">GHC.StgToCmm.Layout</span></a></span><span>  </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">StgToCmm.Layout</span></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier">mapMaybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span class="hs-comment">-- Note [When to lift]</span><span>
</span><span id="line-42"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- $when</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- The analysis proceeds in two steps:</span><span>
</span><span id="line-45"></span><span class="hs-comment">--</span><span>
</span><span id="line-46"></span><span class="hs-comment">--   1. It tags the syntax tree with analysis information in the form of</span><span>
</span><span id="line-47"></span><span class="hs-comment">--      'BinderInfo' at each binder and 'Skeleton's at each let-binding</span><span>
</span><span id="line-48"></span><span class="hs-comment">--      by 'tagSkeletonTopBind' and friends.</span><span>
</span><span id="line-49"></span><span class="hs-comment">--   2. The resulting syntax tree is treated by the &quot;GHC.Stg.Lift&quot;</span><span>
</span><span id="line-50"></span><span class="hs-comment">--      module, calling out to 'goodToLift' to decide if a binding is worthwhile</span><span>
</span><span id="line-51"></span><span class="hs-comment">--      to lift.</span><span>
</span><span id="line-52"></span><span class="hs-comment">--      'goodToLift' consults argument occurrence information in 'BinderInfo'</span><span>
</span><span id="line-53"></span><span class="hs-comment">--      and estimates 'closureGrowth', for which it needs the 'Skeleton'.</span><span>
</span><span id="line-54"></span><span class="hs-comment">--</span><span>
</span><span id="line-55"></span><span class="hs-comment">-- So the annotations from 'tagSkeletonTopBind' ultimately fuel 'goodToLift',</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- which employs a number of heuristics to identify and exclude lambda lifting</span><span>
</span><span id="line-57"></span><span class="hs-comment">-- opportunities deemed non-beneficial:</span><span>
</span><span id="line-58"></span><span class="hs-comment">--</span><span>
</span><span id="line-59"></span><span class="hs-comment">--  [Top-level bindings] can't be lifted.</span><span>
</span><span id="line-60"></span><span class="hs-comment">--  [Thunks] and data constructors shouldn't be lifted in order not to destroy</span><span>
</span><span id="line-61"></span><span class="hs-comment">--    sharing.</span><span>
</span><span id="line-62"></span><span class="hs-comment">--  [Argument occurrences] #arg_occs# of binders prohibit them to be lifted.</span><span>
</span><span id="line-63"></span><span class="hs-comment">--    Doing the lift would re-introduce the very allocation at call sites that</span><span>
</span><span id="line-64"></span><span class="hs-comment">--    we tried to get rid off in the first place. We capture analysis</span><span>
</span><span id="line-65"></span><span class="hs-comment">--    information in 'BinderInfo'. Note that we also consider a nullary</span><span>
</span><span id="line-66"></span><span class="hs-comment">--    application as argument occurrence, because it would turn into an n-ary</span><span>
</span><span id="line-67"></span><span class="hs-comment">--    partial application created by a generic apply function. This occurs in</span><span>
</span><span id="line-68"></span><span class="hs-comment">--    CPS-heavy code like the CS benchmark.</span><span>
</span><span id="line-69"></span><span class="hs-comment">--  [Join points] should not be lifted, simply because there's no reduction in</span><span>
</span><span id="line-70"></span><span class="hs-comment">--    allocation to be had.</span><span>
</span><span id="line-71"></span><span class="hs-comment">--  [Abstracting over join points] destroys join points, because they end up as</span><span>
</span><span id="line-72"></span><span class="hs-comment">--    arguments to the lifted function.</span><span>
</span><span id="line-73"></span><span class="hs-comment">--  [Abstracting over known local functions] turns a known call into an unknown</span><span>
</span><span id="line-74"></span><span class="hs-comment">--    call (e.g. some @stg_ap_*@), which is generally slower. Can be turned off</span><span>
</span><span id="line-75"></span><span class="hs-comment">--    with @-fstg-lift-lams-known@.</span><span>
</span><span id="line-76"></span><span class="hs-comment">--  [Calling convention] Don't lift when the resulting function would have a</span><span>
</span><span id="line-77"></span><span class="hs-comment">--    higher arity than available argument registers for the calling convention.</span><span>
</span><span id="line-78"></span><span class="hs-comment">--    Can be influenced with @-fstg-lift-(non)rec-args(-any)@.</span><span>
</span><span id="line-79"></span><span class="hs-comment">--  [Closure growth] introduced when former free variables have to be available</span><span>
</span><span id="line-80"></span><span class="hs-comment">--    at call sites may actually lead to an increase in overall allocations</span><span>
</span><span id="line-81"></span><span class="hs-comment">--  resulting from a lift. Estimating closure growth is described in</span><span>
</span><span id="line-82"></span><span class="hs-comment">--  &quot;GHC.Stg.Lift.Analysis#clogro&quot; and is what most of this module is ultimately</span><span>
</span><span id="line-83"></span><span class="hs-comment">--  concerned with.</span><span>
</span><span id="line-84"></span><span class="hs-comment">--</span><span>
</span><span id="line-85"></span><span class="hs-comment">-- There's a &lt;https://gitlab.haskell.org/ghc/ghc/wikis/late-lam-lift wiki page&gt; with</span><span>
</span><span id="line-86"></span><span class="hs-comment">-- some more background and history.</span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span class="hs-comment">-- Note [Estimating closure growth]</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- $clogro</span><span>
</span><span id="line-91"></span><span class="hs-comment">-- We estimate closure growth by abstracting the syntax tree into a 'Skeleton',</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- capturing only syntactic details relevant to 'closureGrowth', such as</span><span>
</span><span id="line-93"></span><span class="hs-comment">--</span><span>
</span><span id="line-94"></span><span class="hs-comment">--   * 'ClosureSk', representing closure allocation.</span><span>
</span><span id="line-95"></span><span class="hs-comment">--   * 'RhsSk', representing a RHS of a binding and how many times it's called</span><span>
</span><span id="line-96"></span><span class="hs-comment">--     by an appropriate 'DmdShell'.</span><span>
</span><span id="line-97"></span><span class="hs-comment">--   * 'AltSk', 'BothSk' and 'NilSk' for choice, sequence and empty element.</span><span>
</span><span id="line-98"></span><span class="hs-comment">--</span><span>
</span><span id="line-99"></span><span class="hs-comment">-- This abstraction is mostly so that the main analysis function 'closureGrowth'</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- can stay simple and focused. Also, skeletons tend to be much smaller than</span><span>
</span><span id="line-101"></span><span class="hs-comment">-- the syntax tree they abstract, so it makes sense to construct them once and</span><span>
</span><span id="line-102"></span><span class="hs-comment">-- and operate on them instead of the actual syntax tree.</span><span>
</span><span id="line-103"></span><span class="hs-comment">--</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- A more detailed treatment of computing closure growth, including examples,</span><span>
</span><span id="line-105"></span><span class="hs-comment">-- can be found in the paper referenced from the</span><span>
</span><span id="line-106"></span><span class="hs-comment">-- &lt;https://gitlab.haskell.org/ghc/ghc/wikis/late-lam-lift wiki page&gt;.</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span id="local-6989586621681054071"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#llTrace"><span class="hs-identifier hs-type">llTrace</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681054071"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681054071"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-109"></span><span id="llTrace"><span class="annot"><span class="annottext">llTrace :: forall a. String -&gt; SDoc -&gt; a -&gt; a
</span><a href="GHC.Stg.Lift.Analysis.html#llTrace"><span class="hs-identifier hs-var hs-var">llTrace</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681053886"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681053886"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681053886"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-110"></span><span class="hs-comment">-- llTrace a b c = pprTrace a b c</span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">instance</span><span> </span><span id="BinderP"><span class="annot"><a href="GHC.Stg.Syntax.html#BinderP"><span class="hs-identifier hs-var">BinderP</span></a></span></span><span>      </span><span class="hs-special">'</span><span class="annot"><a href="GHC.Stg.Syntax.html#LiftLams"><span class="hs-identifier hs-type">LiftLams</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BinderInfo"><span class="hs-identifier hs-type">BinderInfo</span></a></span><span>
</span><span id="line-113"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">instance</span><span> </span><span id="XRhsClosure"><span class="annot"><a href="GHC.Stg.Syntax.html#XRhsClosure"><span class="hs-identifier hs-var">XRhsClosure</span></a></span></span><span>  </span><span class="hs-special">'</span><span class="annot"><a href="GHC.Stg.Syntax.html#LiftLams"><span class="hs-identifier hs-type">LiftLams</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span>
</span><span id="line-114"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">instance</span><span> </span><span id="XLet"><span class="annot"><a href="GHC.Stg.Syntax.html#XLet"><span class="hs-identifier hs-var">XLet</span></a></span></span><span>         </span><span class="hs-special">'</span><span class="annot"><a href="GHC.Stg.Syntax.html#LiftLams"><span class="hs-identifier hs-type">LiftLams</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-115"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">instance</span><span> </span><span id="XLetNoEscape"><span class="annot"><a href="GHC.Stg.Syntax.html#XLetNoEscape"><span class="hs-identifier hs-var">XLetNoEscape</span></a></span></span><span> </span><span class="hs-special">'</span><span class="annot"><a href="GHC.Stg.Syntax.html#LiftLams"><span class="hs-identifier hs-type">LiftLams</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span id="local-6989586621681054068"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#freeVarsOfRhs"><span class="hs-identifier hs-type">freeVarsOfRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#XRhsClosure"><span class="hs-identifier hs-type">XRhsClosure</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681054068"><span class="hs-identifier hs-type">pass</span></a></span><span> </span><span class="annot"><span class="hs-operator hs-type">~</span></span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#GenStgRhs"><span class="hs-identifier hs-type">GenStgRhs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681054068"><span class="hs-identifier hs-type">pass</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span></span><span>
</span><span id="line-118"></span><span id="freeVarsOfRhs"><span class="annot"><span class="annottext">freeVarsOfRhs :: forall (pass :: StgPass).
(XRhsClosure pass ~ DIdSet) =&gt;
GenStgRhs pass -&gt; DIdSet
</span><a href="GHC.Stg.Lift.Analysis.html#freeVarsOfRhs"><span class="hs-identifier hs-var hs-var">freeVarsOfRhs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-type">StgRhsCon</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681053879"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053879"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; DIdSet
</span><a href="GHC.Types.Var.Set.html#mkDVarSet"><span class="hs-identifier hs-var">mkDVarSet</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053877"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgVarArg"><span class="hs-identifier hs-type">StgVarArg</span></a></span><span> </span><span id="local-6989586621681053877"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053877"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053879"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-119"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#freeVarsOfRhs"><span class="hs-identifier hs-var">freeVarsOfRhs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-type">StgRhsClosure</span></a></span><span> </span><span id="local-6989586621681053874"><span class="annot"><span class="annottext">XRhsClosure pass
</span><a href="#local-6989586621681053874"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[BinderP pass]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">GenStgExpr pass
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DIdSet
XRhsClosure pass
</span><a href="#local-6989586621681053874"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-120"></span><span>
</span><span id="line-121"></span><span class="hs-comment">-- | Captures details of the syntax tree relevant to the cost model, such as</span><span>
</span><span id="line-122"></span><span class="hs-comment">-- closures, multi-shot lambdas and case expressions.</span><span>
</span><span id="line-123"></span><span class="hs-keyword">data</span><span> </span><span id="Skeleton"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-var">Skeleton</span></a></span></span><span>
</span><span id="line-124"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="ClosureSk"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#ClosureSk"><span class="hs-identifier hs-var">ClosureSk</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span> </span><span class="hs-comment">{- ^ free vars -}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-125"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="RhsSk"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#RhsSk"><span class="hs-identifier hs-var">RhsSk</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span> </span><span class="hs-comment">{- ^ how often the RHS was entered -}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-126"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="AltSk"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#AltSk"><span class="hs-identifier hs-var">AltSk</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-127"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="BothSk"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BothSk"><span class="hs-identifier hs-var">BothSk</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-128"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="NilSk"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span></span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#bothSk"><span class="hs-identifier hs-type">bothSk</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-131"></span><span id="bothSk"><span class="annot"><span class="annottext">bothSk :: Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#bothSk"><span class="hs-identifier hs-var hs-var">bothSk</span></a></span></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span id="local-6989586621681053867"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053867"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053867"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-132"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#bothSk"><span class="hs-identifier hs-var">bothSk</span></a></span><span> </span><span id="local-6989586621681053866"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053866"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053866"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-133"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#bothSk"><span class="hs-identifier hs-var">bothSk</span></a></span><span> </span><span id="local-6989586621681053865"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053865"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681053864"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053864"><span class="hs-identifier hs-var">b</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#BothSk"><span class="hs-identifier hs-var">BothSk</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053865"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053864"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#altSk"><span class="hs-identifier hs-type">altSk</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-136"></span><span id="altSk"><span class="annot"><span class="annottext">altSk :: Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#altSk"><span class="hs-identifier hs-var hs-var">altSk</span></a></span></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span id="local-6989586621681053862"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053862"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053862"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-137"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#altSk"><span class="hs-identifier hs-var">altSk</span></a></span><span> </span><span id="local-6989586621681053861"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053861"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053861"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-138"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#altSk"><span class="hs-identifier hs-var">altSk</span></a></span><span> </span><span id="local-6989586621681053860"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053860"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681053859"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053859"><span class="hs-identifier hs-var">b</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#AltSk"><span class="hs-identifier hs-var">AltSk</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053860"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053859"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#rhsSk"><span class="hs-identifier hs-type">rhsSk</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-141"></span><span id="rhsSk"><span class="annot"><span class="annottext">rhsSk :: DmdShell -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#rhsSk"><span class="hs-identifier hs-var hs-var">rhsSk</span></a></span></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><span class="hs-identifier">_</span></span><span>        </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span>
</span><span id="line-142"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#rhsSk"><span class="hs-identifier hs-var">rhsSk</span></a></span><span> </span><span id="local-6989586621681053857"><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053857"><span class="hs-identifier hs-var">body_dmd</span></a></span></span><span> </span><span id="local-6989586621681053856"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053856"><span class="hs-identifier hs-var">skel</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#RhsSk"><span class="hs-identifier hs-var">RhsSk</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053857"><span class="hs-identifier hs-var">body_dmd</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053856"><span class="hs-identifier hs-var">skel</span></a></span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span class="hs-comment">-- | The type used in binder positions in 'GenStgExpr's.</span><span>
</span><span id="line-145"></span><span class="hs-keyword">data</span><span> </span><span id="BinderInfo"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BinderInfo"><span class="hs-identifier hs-var">BinderInfo</span></a></span></span><span>
</span><span id="line-146"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="BindsClosure"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BindsClosure"><span class="hs-identifier hs-var">BindsClosure</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-comment">-- ^ Let(-no-escape)-bound thing with a flag</span><span>
</span><span id="line-147"></span><span>                           </span><span class="hs-comment">--   indicating whether it occurs as an argument</span><span>
</span><span id="line-148"></span><span>                           </span><span class="hs-comment">--   or in a nullary application</span><span>
</span><span id="line-149"></span><span>                           </span><span class="hs-comment">--   (see &quot;GHC.Stg.Lift.Analysis#arg_occs&quot;).</span><span>
</span><span id="line-150"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="BoringBinder"><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BoringBinder"><span class="hs-identifier hs-var">BoringBinder</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>       </span><span class="hs-comment">-- ^ Every other kind of binder</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span class="hs-comment">-- | Gets the bound 'Id' out a 'BinderInfo'.</span><span>
</span><span id="line-153"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-type">binderInfoBndr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BinderInfo"><span class="hs-identifier hs-type">BinderInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-154"></span><span id="binderInfoBndr"><span class="annot"><span class="annottext">binderInfoBndr :: BinderInfo -&gt; Id
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var hs-var">binderInfoBndr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BoringBinder"><span class="hs-identifier hs-type">BoringBinder</span></a></span><span> </span><span id="local-6989586621681053853"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053853"><span class="hs-identifier hs-var">bndr</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053853"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-155"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var">binderInfoBndr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BindsClosure"><span class="hs-identifier hs-type">BindsClosure</span></a></span><span> </span><span id="local-6989586621681053852"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053852"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053852"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span class="hs-comment">-- | Returns 'Nothing' for 'BoringBinder's and 'Just' the flag indicating</span><span>
</span><span id="line-158"></span><span class="hs-comment">-- occurrences as argument or in a nullary applications otherwise.</span><span>
</span><span id="line-159"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#binderInfoOccursAsArg"><span class="hs-identifier hs-type">binderInfoOccursAsArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BinderInfo"><span class="hs-identifier hs-type">BinderInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-160"></span><span id="binderInfoOccursAsArg"><span class="annot"><span class="annottext">binderInfoOccursAsArg :: BinderInfo -&gt; Maybe Bool
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoOccursAsArg"><span class="hs-identifier hs-var hs-var">binderInfoOccursAsArg</span></a></span></span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BoringBinder"><span class="hs-identifier hs-type">BoringBinder</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Bool
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-161"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#binderInfoOccursAsArg"><span class="hs-identifier hs-var">binderInfoOccursAsArg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BindsClosure"><span class="hs-identifier hs-type">BindsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681053850"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053850"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Maybe Bool
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053850"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681053847"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-164"></span><span>  </span><span id="local-6989586621681053834"><span class="annot"><span class="annottext">ppr :: Skeleton -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-165"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#AltSk"><span class="hs-identifier hs-type">AltSk</span></a></span><span> </span><span id="local-6989586621681053831"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053831"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681053830"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053830"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span>
</span><span id="line-166"></span><span>    </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;{ &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053831"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-167"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ALT&quot;</span></span><span>
</span><span id="line-168"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053830"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-169"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;}&quot;</span></span><span>
</span><span id="line-170"></span><span>    </span><span class="hs-special">]</span><span>
</span><span id="line-171"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BothSk"><span class="hs-identifier hs-type">BothSk</span></a></span><span> </span><span id="local-6989586621681053827"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053827"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681053826"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053826"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053827"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053826"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-172"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#ClosureSk"><span class="hs-identifier hs-type">ClosureSk</span></a></span><span> </span><span id="local-6989586621681053824"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053824"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621681053823"><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053823"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span id="local-6989586621681053822"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053822"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053824"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053823"><span class="hs-identifier hs-var">fvs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053822"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#RhsSk"><span class="hs-identifier hs-type">RhsSk</span></a></span><span> </span><span id="local-6989586621681053820"><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053820"><span class="hs-identifier hs-var">body_dmd</span></a></span></span><span> </span><span id="local-6989586621681053819"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053819"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span>
</span><span id="line-174"></span><span>    </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&#955;[&quot;</span></span><span>
</span><span id="line-175"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681053817"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-176"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;, &quot;</span></span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681053816"><span class="hs-identifier hs-var">use</span></a></span><span>
</span><span id="line-178"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;]. &quot;</span></span><span>
</span><span id="line-179"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053819"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-180"></span><span>    </span><span class="hs-special">]</span><span>
</span><span id="line-181"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-182"></span><span>      </span><span id="local-6989586621681053817"><span class="annot"><span class="annottext">str :: Char
</span><a href="#local-6989586621681053817"><span class="hs-identifier hs-var hs-var">str</span></a></span></span><span>
</span><span id="line-183"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isStrictDmd"><span class="hs-identifier hs-var">isStrictDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053820"><span class="hs-identifier hs-var">body_dmd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'1'</span></span><span>
</span><span id="line-184"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'0'</span></span><span>
</span><span id="line-185"></span><span>      </span><span id="local-6989586621681053816"><span class="annot"><span class="annottext">use :: Char
</span><a href="#local-6989586621681053816"><span class="hs-identifier hs-var hs-var">use</span></a></span></span><span>
</span><span id="line-186"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier hs-var">isAbsDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053820"><span class="hs-identifier hs-var">body_dmd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'0'</span></span><span>
</span><span id="line-187"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedOnce"><span class="hs-identifier hs-var">isUsedOnce</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053820"><span class="hs-identifier hs-var">body_dmd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'1'</span></span><span>
</span><span id="line-188"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&#969;'</span></span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681053810"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BinderInfo"><span class="hs-identifier hs-type">BinderInfo</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-191"></span><span>  </span><span id="local-6989586621681053808"><span class="annot"><span class="annottext">ppr :: BinderInfo -&gt; SDoc
</span><a href="#local-6989586621681053808"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; SDoc) -&gt; (BinderInfo -&gt; Id) -&gt; BinderInfo -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">BinderInfo -&gt; Id
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var">binderInfoBndr</span></a></span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#OutputableBndr"><span class="hs-identifier hs-type">OutputableBndr</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BinderInfo"><span class="hs-identifier hs-type">BinderInfo</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-194"></span><span>  </span><span id="local-6989586621681053796"><span class="annot"><span class="annottext">pprBndr :: BindingSite -&gt; BinderInfo -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprBndr"><span class="hs-identifier hs-var hs-var hs-var hs-var">pprBndr</span></a></span></span><span> </span><span id="local-6989586621681053794"><span class="annot"><span class="annottext">BindingSite
</span><a href="#local-6989586621681053794"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BindingSite -&gt; Id -&gt; SDoc
forall a. OutputableBndr a =&gt; BindingSite -&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprBndr"><span class="hs-identifier hs-var">pprBndr</span></a></span><span> </span><span class="annot"><span class="annottext">BindingSite
</span><a href="#local-6989586621681053794"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; SDoc) -&gt; (BinderInfo -&gt; Id) -&gt; BinderInfo -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">BinderInfo -&gt; Id
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var">binderInfoBndr</span></a></span><span>
</span><span id="line-195"></span><span>  </span><span id="local-6989586621681053792"><span class="annot"><span class="annottext">pprPrefixOcc :: BinderInfo -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprPrefixOcc"><span class="hs-identifier hs-var hs-var hs-var hs-var">pprPrefixOcc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. OutputableBndr a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprPrefixOcc"><span class="hs-identifier hs-var">pprPrefixOcc</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; SDoc) -&gt; (BinderInfo -&gt; Id) -&gt; BinderInfo -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">BinderInfo -&gt; Id
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var">binderInfoBndr</span></a></span><span>
</span><span id="line-196"></span><span>  </span><span id="local-6989586621681053789"><span class="annot"><span class="annottext">pprInfixOcc :: BinderInfo -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprInfixOcc"><span class="hs-identifier hs-var hs-var hs-var hs-var">pprInfixOcc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. OutputableBndr a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprInfixOcc"><span class="hs-identifier hs-var">pprInfixOcc</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; SDoc) -&gt; (BinderInfo -&gt; Id) -&gt; BinderInfo -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">BinderInfo -&gt; Id
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var">binderInfoBndr</span></a></span><span>
</span><span id="line-197"></span><span>  </span><span id="local-6989586621681053786"><span class="annot"><span class="annottext">bndrIsJoin_maybe :: BinderInfo -&gt; Maybe Int
</span><a href="GHC.Utils.Outputable.html#bndrIsJoin_maybe"><span class="hs-identifier hs-var hs-var hs-var hs-var">bndrIsJoin_maybe</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Maybe Int
forall a. OutputableBndr a =&gt; a -&gt; Maybe Int
</span><a href="GHC.Utils.Outputable.html#bndrIsJoin_maybe"><span class="hs-identifier hs-var">bndrIsJoin_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Maybe Int) -&gt; (BinderInfo -&gt; Id) -&gt; BinderInfo -&gt; Maybe Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">BinderInfo -&gt; Id
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var">binderInfoBndr</span></a></span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#mkArgOccs"><span class="hs-identifier hs-type">mkArgOccs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgArg"><span class="hs-identifier hs-type">StgArg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span>
</span><span id="line-200"></span><span id="mkArgOccs"><span class="annot"><span class="annottext">mkArgOccs :: [StgArg] -&gt; IdSet
</span><a href="GHC.Stg.Lift.Analysis.html#mkArgOccs"><span class="hs-identifier hs-var hs-var">mkArgOccs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#mkVarSet"><span class="hs-identifier hs-var">mkVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">([Id] -&gt; IdSet) -&gt; ([StgArg] -&gt; [Id]) -&gt; [StgArg] -&gt; IdSet
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(StgArg -&gt; Maybe Id) -&gt; [StgArg] -&gt; [Id]
forall a b. (a -&gt; Maybe b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier hs-var">mapMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg -&gt; Maybe Id
</span><a href="#local-6989586621681053782"><span class="hs-identifier hs-var">stg_arg_var</span></a></span><span>
</span><span id="line-201"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-202"></span><span>    </span><span id="local-6989586621681053782"><span class="annot"><span class="annottext">stg_arg_var :: StgArg -&gt; Maybe Id
</span><a href="#local-6989586621681053782"><span class="hs-identifier hs-var hs-var">stg_arg_var</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgVarArg"><span class="hs-identifier hs-type">StgVarArg</span></a></span><span> </span><span id="local-6989586621681053781"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053781"><span class="hs-identifier hs-var">occ</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Maybe Id
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053781"><span class="hs-identifier hs-var">occ</span></a></span><span>
</span><span id="line-203"></span><span>    </span><span class="annot"><a href="#local-6989586621681053782"><span class="hs-identifier hs-var">stg_arg_var</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Id
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-204"></span><span>
</span><span id="line-205"></span><span class="hs-comment">-- | Tags every binder with its 'BinderInfo' and let bindings with their</span><span>
</span><span id="line-206"></span><span class="hs-comment">-- 'Skeleton's.</span><span>
</span><span id="line-207"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonTopBind"><span class="hs-identifier hs-type">tagSkeletonTopBind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgBinding"><span class="hs-identifier hs-type">CgStgBinding</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgBinding"><span class="hs-identifier hs-type">LlStgBinding</span></a></span><span>
</span><span id="line-208"></span><span class="hs-comment">-- NilSk is OK when tagging top-level bindings. Also, top-level things are never</span><span>
</span><span id="line-209"></span><span class="hs-comment">-- lambda-lifted, so no need to track their argument occurrences. They can also</span><span>
</span><span id="line-210"></span><span class="hs-comment">-- never be let-no-escapes (thus we pass False).</span><span>
</span><span id="line-211"></span><span id="tagSkeletonTopBind"><span class="annot"><span class="annottext">tagSkeletonTopBind :: CgStgBinding -&gt; LlStgBinding
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonTopBind"><span class="hs-identifier hs-var hs-var">tagSkeletonTopBind</span></a></span></span><span> </span><span id="local-6989586621681053780"><span class="annot"><span class="annottext">CgStgBinding
</span><a href="#local-6989586621681053780"><span class="hs-identifier hs-var">bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlStgBinding
</span><a href="#local-6989586621681053779"><span class="hs-identifier hs-var">bind'</span></a></span><span>
</span><span id="line-212"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053779"><span class="annot"><span class="annottext">LlStgBinding
</span><a href="#local-6989586621681053779"><span class="hs-identifier hs-var">bind'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; Skeleton
-&gt; IdSet
-&gt; CgStgBinding
-&gt; (Skeleton, IdSet, Skeleton, LlStgBinding)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonBinding"><span class="hs-identifier hs-var">tagSkeletonBinding</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="GHC.Types.Var.Set.html#emptyVarSet"><span class="hs-identifier hs-var">emptyVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgBinding
</span><a href="#local-6989586621681053780"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span class="hs-comment">-- | Tags binders of an 'StgExpr' with its 'BinderInfo' and let bindings with</span><span>
</span><span id="line-216"></span><span class="hs-comment">-- their 'Skeleton's. Additionally, returns its 'Skeleton' and the set of binder</span><span>
</span><span id="line-217"></span><span class="hs-comment">-- occurrences in argument and nullary application position</span><span>
</span><span id="line-218"></span><span class="hs-comment">-- (cf. &quot;GHC.Stg.Lift.Analysis#arg_occs&quot;).</span><span>
</span><span id="line-219"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-type">tagSkeletonExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgExpr"><span class="hs-identifier hs-type">CgStgExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgExpr"><span class="hs-identifier hs-type">LlStgExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span id="tagSkeletonExpr"><span class="annot"><span class="annottext">tagSkeletonExpr :: CgStgExpr -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var hs-var">tagSkeletonExpr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLit"><span class="hs-identifier hs-type">StgLit</span></a></span><span> </span><span id="local-6989586621681053774"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621681053774"><span class="hs-identifier hs-var">lit</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="GHC.Types.Var.Set.html#emptyVarSet"><span class="hs-identifier hs-var">emptyVarSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; LlStgExpr
forall (pass :: StgPass). Literal -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgLit"><span class="hs-identifier hs-var">StgLit</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621681053774"><span class="hs-identifier hs-var">lit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgConApp"><span class="hs-identifier hs-type">StgConApp</span></a></span><span> </span><span id="local-6989586621681053772"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681053772"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681053771"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053771"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681053770"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681053770"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-223"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; IdSet
</span><a href="GHC.Stg.Lift.Analysis.html#mkArgOccs"><span class="hs-identifier hs-var">mkArgOccs</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053771"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [StgArg] -&gt; [Type] -&gt; LlStgExpr
forall (pass :: StgPass).
DataCon -&gt; [StgArg] -&gt; [Type] -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgConApp"><span class="hs-identifier hs-var">StgConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681053772"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053771"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681053770"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgOpApp"><span class="hs-identifier hs-type">StgOpApp</span></a></span><span> </span><span id="local-6989586621681053768"><span class="annot"><span class="annottext">StgOp
</span><a href="#local-6989586621681053768"><span class="hs-identifier hs-var">op</span></a></span></span><span> </span><span id="local-6989586621681053767"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053767"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681053766"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681053766"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-225"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; IdSet
</span><a href="GHC.Stg.Lift.Analysis.html#mkArgOccs"><span class="hs-identifier hs-var">mkArgOccs</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053767"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StgOp -&gt; [StgArg] -&gt; Type -&gt; LlStgExpr
forall (pass :: StgPass).
StgOp -&gt; [StgArg] -&gt; Type -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgOpApp"><span class="hs-identifier hs-var">StgOpApp</span></a></span><span> </span><span class="annot"><span class="annottext">StgOp
</span><a href="#local-6989586621681053768"><span class="hs-identifier hs-var">op</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053767"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681053766"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-type">StgApp</span></a></span><span> </span><span id="local-6989586621681053764"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053764"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621681053763"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053763"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053762"><span class="hs-identifier hs-var">arg_occs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; [StgArg] -&gt; LlStgExpr
forall (pass :: StgPass). Id -&gt; [StgArg] -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-var">StgApp</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053764"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053763"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-229"></span><span>    </span><span id="local-6989586621681053762"><span class="annot"><span class="annottext">arg_occs :: IdSet
</span><a href="#local-6989586621681053762"><span class="hs-identifier hs-var hs-var">arg_occs</span></a></span></span><span>
</span><span id="line-230"></span><span>      </span><span class="hs-comment">-- This checks for nullary applications, which we treat the same as</span><span>
</span><span id="line-231"></span><span>      </span><span class="hs-comment">-- argument occurrences, see &quot;GHC.Stg.Lift.Analysis#arg_occs&quot;.</span><span>
</span><span id="line-232"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053763"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#unitVarSet"><span class="hs-identifier hs-var">unitVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053764"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-233"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; IdSet
</span><a href="GHC.Stg.Lift.Analysis.html#mkArgOccs"><span class="hs-identifier hs-var">mkArgOccs</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053763"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-234"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLam"><span class="hs-identifier hs-type">StgLam</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty (BinderP 'CodeGen)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; (Skeleton, IdSet, LlStgExpr)
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;stgLiftLams&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;StgLam&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgCase"><span class="hs-identifier hs-type">StgCase</span></a></span><span> </span><span id="local-6989586621681053756"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053756"><span class="hs-identifier hs-var">scrut</span></a></span></span><span> </span><span id="local-6989586621681053755"><span class="annot"><span class="annottext">BinderP 'CodeGen
</span><a href="#local-6989586621681053755"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681053754"><span class="annot"><span class="annottext">AltType
</span><a href="#local-6989586621681053754"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681053753"><span class="annot"><span class="annottext">[GenStgAlt 'CodeGen]
</span><a href="#local-6989586621681053753"><span class="hs-identifier hs-var">alts</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-236"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053752"><span class="hs-identifier hs-var">skel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053751"><span class="hs-identifier hs-var">arg_occs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlStgExpr
-&gt; BinderP 'LiftLams
-&gt; AltType
-&gt; [GenStgAlt 'LiftLams]
-&gt; LlStgExpr
forall (pass :: StgPass).
GenStgExpr pass
-&gt; BinderP pass -&gt; AltType -&gt; [GenStgAlt pass] -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgCase"><span class="hs-identifier hs-var">StgCase</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053750"><span class="hs-identifier hs-var">scrut'</span></a></span><span> </span><span class="annot"><span class="annottext">BinderP 'LiftLams
BinderInfo
</span><a href="#local-6989586621681053749"><span class="hs-identifier hs-var">bndr'</span></a></span><span> </span><span class="annot"><span class="annottext">AltType
</span><a href="#local-6989586621681053754"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">[GenStgAlt 'LiftLams]
[(AltCon, [BinderInfo], LlStgExpr)]
</span><a href="#local-6989586621681053748"><span class="hs-identifier hs-var">alts'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-237"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-238"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053747"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053747"><span class="hs-identifier hs-var">scrut_skel</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053746"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053746"><span class="hs-identifier hs-var">scrut_arg_occs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053750"><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053750"><span class="hs-identifier hs-var">scrut'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053756"><span class="hs-identifier hs-var">scrut</span></a></span><span>
</span><span id="line-239"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053745"><span class="annot"><span class="annottext">[Skeleton]
</span><a href="#local-6989586621681053745"><span class="hs-identifier hs-var">alt_skels</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053744"><span class="annot"><span class="annottext">[IdSet]
</span><a href="#local-6989586621681053744"><span class="hs-identifier hs-var">alt_arg_occss</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053748"><span class="annot"><span class="annottext">[(AltCon, [BinderInfo], LlStgExpr)]
</span><a href="#local-6989586621681053748"><span class="hs-identifier hs-var">alts'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((AltCon, [Id], CgStgExpr)
 -&gt; (Skeleton, IdSet, (AltCon, [BinderInfo], LlStgExpr)))
-&gt; [(AltCon, [Id], CgStgExpr)]
-&gt; ([Skeleton], [IdSet], [(AltCon, [BinderInfo], LlStgExpr)])
forall a b c d. (a -&gt; (b, c, d)) -&gt; [a] -&gt; ([b], [c], [d])
</span><a href="GHC.Utils.Misc.html#mapAndUnzip3"><span class="hs-identifier hs-var">mapAndUnzip3</span></a></span><span> </span><span class="annot"><span class="annottext">(AltCon, [Id], CgStgExpr)
-&gt; (Skeleton, IdSet, (AltCon, [BinderInfo], LlStgExpr))
GenStgAlt 'CodeGen -&gt; (Skeleton, IdSet, GenStgAlt 'LiftLams)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonAlt"><span class="hs-identifier hs-var">tagSkeletonAlt</span></a></span><span> </span><span class="annot"><span class="annottext">[(AltCon, [Id], CgStgExpr)]
[GenStgAlt 'CodeGen]
</span><a href="#local-6989586621681053753"><span class="hs-identifier hs-var">alts</span></a></span><span>
</span><span id="line-240"></span><span>    </span><span id="local-6989586621681053752"><span class="annot"><span class="annottext">skel :: Skeleton
</span><a href="#local-6989586621681053752"><span class="hs-identifier hs-var hs-var">skel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#bothSk"><span class="hs-identifier hs-var">bothSk</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053747"><span class="hs-identifier hs-var">scrut_skel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Skeleton -&gt; Skeleton -&gt; Skeleton)
-&gt; Skeleton -&gt; [Skeleton] -&gt; Skeleton
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#altSk"><span class="hs-identifier hs-var">altSk</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span class="annot"><span class="annottext">[Skeleton]
</span><a href="#local-6989586621681053745"><span class="hs-identifier hs-var">alt_skels</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-241"></span><span>    </span><span id="local-6989586621681053751"><span class="annot"><span class="annottext">arg_occs :: IdSet
</span><a href="#local-6989586621681053751"><span class="hs-identifier hs-var hs-var">arg_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[IdSet] -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#unionVarSets"><span class="hs-identifier hs-var">unionVarSets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053746"><span class="hs-identifier hs-var">scrut_arg_occs</span></a></span><span class="annot"><span class="annottext">IdSet -&gt; [IdSet] -&gt; [IdSet]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[IdSet]
</span><a href="#local-6989586621681053744"><span class="hs-identifier hs-var">alt_arg_occss</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IdSet -&gt; Id -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#delVarSet"><span class="hs-operator hs-var">`delVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681053755"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-242"></span><span>    </span><span id="local-6989586621681053749"><span class="annot"><span class="annottext">bndr' :: BinderInfo
</span><a href="#local-6989586621681053749"><span class="hs-identifier hs-var hs-var">bndr'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; BinderInfo
</span><a href="GHC.Stg.Lift.Analysis.html#BoringBinder"><span class="hs-identifier hs-var">BoringBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681053755"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-243"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTick"><span class="hs-identifier hs-type">StgTick</span></a></span><span> </span><span id="local-6989586621681053737"><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621681053737"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621681053736"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053736"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-244"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053735"><span class="hs-identifier hs-var">skel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053734"><span class="hs-identifier hs-var">arg_occs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; LlStgExpr -&gt; LlStgExpr
forall (pass :: StgPass).
Tickish Id -&gt; GenStgExpr pass -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgTick"><span class="hs-identifier hs-var">StgTick</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621681053737"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053733"><span class="hs-identifier hs-var">e'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-245"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-246"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053735"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053735"><span class="hs-identifier hs-var">skel</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053734"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053734"><span class="hs-identifier hs-var">arg_occs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053733"><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053733"><span class="hs-identifier hs-var">e'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053736"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-247"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLet"><span class="hs-identifier hs-type">StgLet</span></a></span><span> </span><span class="annot"><span class="annottext">XLet 'CodeGen
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681053731"><span class="annot"><span class="annottext">CgStgBinding
</span><a href="#local-6989586621681053731"><span class="hs-identifier hs-var">bind</span></a></span></span><span> </span><span id="local-6989586621681053730"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053730"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CgStgExpr -&gt; CgStgBinding -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonLet"><span class="hs-identifier hs-var">tagSkeletonLet</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053730"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgBinding
</span><a href="#local-6989586621681053731"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-248"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLetNoEscape"><span class="hs-identifier hs-type">StgLetNoEscape</span></a></span><span> </span><span class="annot"><span class="annottext">XLetNoEscape 'CodeGen
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681053727"><span class="annot"><span class="annottext">CgStgBinding
</span><a href="#local-6989586621681053727"><span class="hs-identifier hs-var">bind</span></a></span></span><span> </span><span id="local-6989586621681053726"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053726"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CgStgExpr -&gt; CgStgBinding -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonLet"><span class="hs-identifier hs-var">tagSkeletonLet</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053726"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgBinding
</span><a href="#local-6989586621681053727"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#mkLet"><span class="hs-identifier hs-type">mkLet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgBinding"><span class="hs-identifier hs-type">LlStgBinding</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgExpr"><span class="hs-identifier hs-type">LlStgExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgExpr"><span class="hs-identifier hs-type">LlStgExpr</span></a></span><span>
</span><span id="line-251"></span><span id="mkLet"><span class="annot"><span class="annottext">mkLet :: Bool -&gt; Skeleton -&gt; LlStgBinding -&gt; LlStgExpr -&gt; LlStgExpr
</span><a href="GHC.Stg.Lift.Analysis.html#mkLet"><span class="hs-identifier hs-var hs-var">mkLet</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; LlStgBinding -&gt; LlStgExpr -&gt; LlStgExpr
forall (pass :: StgPass).
XLetNoEscape pass
-&gt; GenStgBinding pass -&gt; GenStgExpr pass -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgLetNoEscape"><span class="hs-identifier hs-var">StgLetNoEscape</span></a></span><span>
</span><span id="line-252"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#mkLet"><span class="hs-identifier hs-var">mkLet</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; LlStgBinding -&gt; LlStgExpr -&gt; LlStgExpr
forall (pass :: StgPass).
XLet pass
-&gt; GenStgBinding pass -&gt; GenStgExpr pass -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgLet"><span class="hs-identifier hs-var">StgLet</span></a></span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonLet"><span class="hs-identifier hs-type">tagSkeletonLet</span></a></span><span>
</span><span id="line-255"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-256"></span><span>  </span><span class="hs-comment">-- ^ Is the binding a let-no-escape?</span><span>
</span><span id="line-257"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgExpr"><span class="hs-identifier hs-type">CgStgExpr</span></a></span><span>
</span><span id="line-258"></span><span>  </span><span class="hs-comment">-- ^ Let body</span><span>
</span><span id="line-259"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgBinding"><span class="hs-identifier hs-type">CgStgBinding</span></a></span><span>
</span><span id="line-260"></span><span>  </span><span class="hs-comment">-- ^ Binding group</span><span>
</span><span id="line-261"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgExpr"><span class="hs-identifier hs-type">LlStgExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-262"></span><span>  </span><span class="hs-comment">-- ^ RHS skeletons, argument occurrences and annotated binding</span><span>
</span><span id="line-263"></span><span id="tagSkeletonLet"><span class="annot"><span class="annottext">tagSkeletonLet :: Bool -&gt; CgStgExpr -&gt; CgStgBinding -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonLet"><span class="hs-identifier hs-var hs-var">tagSkeletonLet</span></a></span></span><span> </span><span id="local-6989586621681053724"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053724"><span class="hs-identifier hs-var">is_lne</span></a></span></span><span> </span><span id="local-6989586621681053723"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053723"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span id="local-6989586621681053722"><span class="annot"><span class="annottext">CgStgBinding
</span><a href="#local-6989586621681053722"><span class="hs-identifier hs-var">bind</span></a></span></span><span>
</span><span id="line-264"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053721"><span class="hs-identifier hs-var">let_skel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053720"><span class="hs-identifier hs-var">arg_occs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Skeleton -&gt; LlStgBinding -&gt; LlStgExpr -&gt; LlStgExpr
</span><a href="GHC.Stg.Lift.Analysis.html#mkLet"><span class="hs-identifier hs-var">mkLet</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053724"><span class="hs-identifier hs-var">is_lne</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053719"><span class="hs-identifier hs-var">scope</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgBinding
</span><a href="#local-6989586621681053718"><span class="hs-identifier hs-var">bind'</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053717"><span class="hs-identifier hs-var">body'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-266"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053716"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053716"><span class="hs-identifier hs-var">body_skel</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053715"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053715"><span class="hs-identifier hs-var">body_arg_occs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053717"><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053717"><span class="hs-identifier hs-var">body'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053723"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-267"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053721"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053721"><span class="hs-identifier hs-var">let_skel</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053720"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053720"><span class="hs-identifier hs-var">arg_occs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053719"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053719"><span class="hs-identifier hs-var">scope</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053718"><span class="annot"><span class="annottext">LlStgBinding
</span><a href="#local-6989586621681053718"><span class="hs-identifier hs-var">bind'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-268"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; Skeleton
-&gt; IdSet
-&gt; CgStgBinding
-&gt; (Skeleton, IdSet, Skeleton, LlStgBinding)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonBinding"><span class="hs-identifier hs-var">tagSkeletonBinding</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053724"><span class="hs-identifier hs-var">is_lne</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053716"><span class="hs-identifier hs-var">body_skel</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053715"><span class="hs-identifier hs-var">body_arg_occs</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgBinding
</span><a href="#local-6989586621681053722"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-269"></span><span>
</span><span id="line-270"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonBinding"><span class="hs-identifier hs-type">tagSkeletonBinding</span></a></span><span>
</span><span id="line-271"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-272"></span><span>  </span><span class="hs-comment">-- ^ Is the binding a let-no-escape?</span><span>
</span><span id="line-273"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-274"></span><span>  </span><span class="hs-comment">-- ^ Let body skeleton</span><span>
</span><span id="line-275"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span>
</span><span id="line-276"></span><span>  </span><span class="hs-comment">-- ^ Argument occurrences in the body</span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgBinding"><span class="hs-identifier hs-type">CgStgBinding</span></a></span><span>
</span><span id="line-278"></span><span>  </span><span class="hs-comment">-- ^ Binding group</span><span>
</span><span id="line-279"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgBinding"><span class="hs-identifier hs-type">LlStgBinding</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-280"></span><span>  </span><span class="hs-comment">-- ^ Let skeleton, argument occurrences, scope skeleton of binding and</span><span>
</span><span id="line-281"></span><span>  </span><span class="hs-comment">--   the annotated binding</span><span>
</span><span id="line-282"></span><span id="tagSkeletonBinding"><span class="annot"><span class="annottext">tagSkeletonBinding :: Bool
-&gt; Skeleton
-&gt; IdSet
-&gt; CgStgBinding
-&gt; (Skeleton, IdSet, Skeleton, LlStgBinding)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonBinding"><span class="hs-identifier hs-var hs-var">tagSkeletonBinding</span></a></span></span><span> </span><span id="local-6989586621681053714"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053714"><span class="hs-identifier hs-var">is_lne</span></a></span></span><span> </span><span id="local-6989586621681053713"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053713"><span class="hs-identifier hs-var">body_skel</span></a></span></span><span> </span><span id="local-6989586621681053712"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053712"><span class="hs-identifier hs-var">body_arg_occs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgNonRec"><span class="hs-identifier hs-type">StgNonRec</span></a></span><span> </span><span id="local-6989586621681053710"><span class="annot"><span class="annottext">BinderP 'CodeGen
</span><a href="#local-6989586621681053710"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681053709"><span class="annot"><span class="annottext">GenStgRhs 'CodeGen
</span><a href="#local-6989586621681053709"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053708"><span class="hs-identifier hs-var">let_skel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053707"><span class="hs-identifier hs-var">arg_occs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053706"><span class="hs-identifier hs-var">scope</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlStgBinding
</span><a href="#local-6989586621681053705"><span class="hs-identifier hs-var">bind'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-284"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-285"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053704"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053704"><span class="hs-identifier hs-var">rhs_skel</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053703"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053703"><span class="hs-identifier hs-var">rhs_arg_occs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053702"><span class="annot"><span class="annottext">LlStgRhs
</span><a href="#local-6989586621681053702"><span class="hs-identifier hs-var">rhs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; GenStgRhs 'CodeGen -&gt; (Skeleton, IdSet, LlStgRhs)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonRhs"><span class="hs-identifier hs-var">tagSkeletonRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681053710"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgRhs 'CodeGen
</span><a href="#local-6989586621681053709"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-286"></span><span>    </span><span id="local-6989586621681053707"><span class="annot"><span class="annottext">arg_occs :: IdSet
</span><a href="#local-6989586621681053707"><span class="hs-identifier hs-var hs-var">arg_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053712"><span class="hs-identifier hs-var">body_arg_occs</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet -&gt; IdSet -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#unionVarSet"><span class="hs-operator hs-var">`unionVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053703"><span class="hs-identifier hs-var">rhs_arg_occs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IdSet -&gt; Id -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#delVarSet"><span class="hs-operator hs-var">`delVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681053710"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-287"></span><span>    </span><span id="local-6989586621681053699"><span class="annot"><span class="annottext">bind_skel :: Skeleton
</span><a href="#local-6989586621681053699"><span class="hs-identifier hs-var hs-var">bind_skel</span></a></span></span><span>
</span><span id="line-288"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053714"><span class="hs-identifier hs-var">is_lne</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053704"><span class="hs-identifier hs-var">rhs_skel</span></a></span><span> </span><span class="hs-comment">-- no closure is allocated for let-no-escapes</span><span>
</span><span id="line-289"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; DIdSet -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#ClosureSk"><span class="hs-identifier hs-var">ClosureSk</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681053710"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenStgRhs 'CodeGen -&gt; DIdSet
forall (pass :: StgPass).
(XRhsClosure pass ~ DIdSet) =&gt;
GenStgRhs pass -&gt; DIdSet
</span><a href="GHC.Stg.Lift.Analysis.html#freeVarsOfRhs"><span class="hs-identifier hs-var">freeVarsOfRhs</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgRhs 'CodeGen
</span><a href="#local-6989586621681053709"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053704"><span class="hs-identifier hs-var">rhs_skel</span></a></span><span>
</span><span id="line-290"></span><span>    </span><span id="local-6989586621681053708"><span class="annot"><span class="annottext">let_skel :: Skeleton
</span><a href="#local-6989586621681053708"><span class="hs-identifier hs-var hs-var">let_skel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#bothSk"><span class="hs-identifier hs-var">bothSk</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053713"><span class="hs-identifier hs-var">body_skel</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053699"><span class="hs-identifier hs-var">bind_skel</span></a></span><span>
</span><span id="line-291"></span><span>    </span><span id="local-6989586621681053698"><span class="annot"><span class="annottext">occurs_as_arg :: Bool
</span><a href="#local-6989586621681053698"><span class="hs-identifier hs-var hs-var">occurs_as_arg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681053710"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; IdSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053712"><span class="hs-identifier hs-var">body_arg_occs</span></a></span><span>
</span><span id="line-292"></span><span>    </span><span class="hs-comment">-- Compared to the recursive case, this exploits the fact that @bndr@ is</span><span>
</span><span id="line-293"></span><span>    </span><span class="hs-comment">-- never free in @rhs@.</span><span>
</span><span id="line-294"></span><span>    </span><span id="local-6989586621681053706"><span class="annot"><span class="annottext">scope :: Skeleton
</span><a href="#local-6989586621681053706"><span class="hs-identifier hs-var hs-var">scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053713"><span class="hs-identifier hs-var">body_skel</span></a></span><span>
</span><span id="line-295"></span><span>    </span><span id="local-6989586621681053705"><span class="annot"><span class="annottext">bind' :: LlStgBinding
</span><a href="#local-6989586621681053705"><span class="hs-identifier hs-var hs-var">bind'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BinderP 'LiftLams -&gt; LlStgRhs -&gt; LlStgBinding
forall (pass :: StgPass).
BinderP pass -&gt; GenStgRhs pass -&gt; GenStgBinding pass
</span><a href="GHC.Stg.Syntax.html#StgNonRec"><span class="hs-identifier hs-var">StgNonRec</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Bool -&gt; BinderInfo
</span><a href="GHC.Stg.Lift.Analysis.html#BindsClosure"><span class="hs-identifier hs-var">BindsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681053710"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053698"><span class="hs-identifier hs-var">occurs_as_arg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlStgRhs
</span><a href="#local-6989586621681053702"><span class="hs-identifier hs-var">rhs'</span></a></span><span>
</span><span id="line-296"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonBinding"><span class="hs-identifier hs-var">tagSkeletonBinding</span></a></span><span> </span><span id="local-6989586621681053696"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053696"><span class="hs-identifier hs-var">is_lne</span></a></span></span><span> </span><span id="local-6989586621681053695"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053695"><span class="hs-identifier hs-var">body_skel</span></a></span></span><span> </span><span id="local-6989586621681053694"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053694"><span class="hs-identifier hs-var">body_arg_occs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRec"><span class="hs-identifier hs-type">StgRec</span></a></span><span> </span><span id="local-6989586621681053692"><span class="annot"><span class="annottext">[(BinderP 'CodeGen, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681053692"><span class="hs-identifier hs-var">pairs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053691"><span class="hs-identifier hs-var">let_skel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053690"><span class="hs-identifier hs-var">arg_occs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053689"><span class="hs-identifier hs-var">scope</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(BinderP 'LiftLams, LlStgRhs)] -&gt; LlStgBinding
forall (pass :: StgPass).
[(BinderP pass, GenStgRhs pass)] -&gt; GenStgBinding pass
</span><a href="GHC.Stg.Syntax.html#StgRec"><span class="hs-identifier hs-var">StgRec</span></a></span><span> </span><span class="annot"><span class="annottext">[(BinderP 'LiftLams, LlStgRhs)]
[(BinderInfo, LlStgRhs)]
</span><a href="#local-6989586621681053688"><span class="hs-identifier hs-var">pairs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-298"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-299"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053687"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053687"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[GenStgRhs 'CodeGen]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Id, GenStgRhs 'CodeGen)] -&gt; ([Id], [GenStgRhs 'CodeGen])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, GenStgRhs 'CodeGen)]
[(BinderP 'CodeGen, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681053692"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-300"></span><span>    </span><span class="hs-comment">-- Local recursive STG bindings also regard the defined binders as free</span><span>
</span><span id="line-301"></span><span>    </span><span class="hs-comment">-- vars. We want to delete those for our cost model, as these are known</span><span>
</span><span id="line-302"></span><span>    </span><span class="hs-comment">-- calls anyway when we add them to the same top-level recursive group as</span><span>
</span><span id="line-303"></span><span>    </span><span class="hs-comment">-- the top-level binding currently being analysed.</span><span>
</span><span id="line-304"></span><span>    </span><span id="local-6989586621681053685"><span class="annot"><span class="annottext">skel_occs_rhss' :: [(Skeleton, IdSet, LlStgRhs)]
</span><a href="#local-6989586621681053685"><span class="hs-identifier hs-var hs-var">skel_occs_rhss'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Id, GenStgRhs 'CodeGen) -&gt; (Skeleton, IdSet, LlStgRhs))
-&gt; [(Id, GenStgRhs 'CodeGen)] -&gt; [(Skeleton, IdSet, LlStgRhs)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Id -&gt; GenStgRhs 'CodeGen -&gt; (Skeleton, IdSet, LlStgRhs))
-&gt; (Id, GenStgRhs 'CodeGen) -&gt; (Skeleton, IdSet, LlStgRhs)
forall a b c. (a -&gt; b -&gt; c) -&gt; (a, b) -&gt; c
</span><a href="../../base/src/Data.Tuple.html#uncurry"><span class="hs-identifier hs-var">uncurry</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; GenStgRhs 'CodeGen -&gt; (Skeleton, IdSet, LlStgRhs)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonRhs"><span class="hs-identifier hs-var">tagSkeletonRhs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Id, GenStgRhs 'CodeGen)]
[(BinderP 'CodeGen, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681053692"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-305"></span><span>    </span><span id="local-6989586621681053683"><span class="annot"><span class="annottext">rhss_arg_occs :: [IdSet]
</span><a href="#local-6989586621681053683"><span class="hs-identifier hs-var hs-var">rhss_arg_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Skeleton, IdSet, LlStgRhs) -&gt; IdSet)
-&gt; [(Skeleton, IdSet, LlStgRhs)] -&gt; [IdSet]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Skeleton, IdSet, LlStgRhs) -&gt; IdSet
forall a b c. (a, b, c) -&gt; b
</span><a href="GHC.Utils.Misc.html#sndOf3"><span class="hs-identifier hs-var">sndOf3</span></a></span><span> </span><span class="annot"><span class="annottext">[(Skeleton, IdSet, LlStgRhs)]
</span><a href="#local-6989586621681053685"><span class="hs-identifier hs-var">skel_occs_rhss'</span></a></span><span>
</span><span id="line-306"></span><span>    </span><span id="local-6989586621681053681"><span class="annot"><span class="annottext">scope_occs :: IdSet
</span><a href="#local-6989586621681053681"><span class="hs-identifier hs-var hs-var">scope_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[IdSet] -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#unionVarSets"><span class="hs-identifier hs-var">unionVarSets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053694"><span class="hs-identifier hs-var">body_arg_occs</span></a></span><span class="annot"><span class="annottext">IdSet -&gt; [IdSet] -&gt; [IdSet]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[IdSet]
</span><a href="#local-6989586621681053683"><span class="hs-identifier hs-var">rhss_arg_occs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-307"></span><span>    </span><span id="local-6989586621681053690"><span class="annot"><span class="annottext">arg_occs :: IdSet
</span><a href="#local-6989586621681053690"><span class="hs-identifier hs-var hs-var">arg_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053681"><span class="hs-identifier hs-var">scope_occs</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet -&gt; [Id] -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#delVarSetList"><span class="hs-operator hs-var">`delVarSetList`</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053687"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-308"></span><span>    </span><span class="hs-comment">-- @skel_rhss@ aren't yet wrapped in closures. We'll do that in a moment,</span><span>
</span><span id="line-309"></span><span>    </span><span class="hs-comment">-- but we also need the un-wrapped skeletons for calculating the @scope@</span><span>
</span><span id="line-310"></span><span>    </span><span class="hs-comment">-- of the group, as the outer closures don't contribute to closure growth</span><span>
</span><span id="line-311"></span><span>    </span><span class="hs-comment">-- when we lift this specific binding.</span><span>
</span><span id="line-312"></span><span>    </span><span id="local-6989586621681053689"><span class="annot"><span class="annottext">scope :: Skeleton
</span><a href="#local-6989586621681053689"><span class="hs-identifier hs-var hs-var">scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Skeleton, IdSet, LlStgRhs) -&gt; Skeleton -&gt; Skeleton)
-&gt; Skeleton -&gt; [(Skeleton, IdSet, LlStgRhs)] -&gt; Skeleton
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#bothSk"><span class="hs-identifier hs-var">bothSk</span></a></span><span> </span><span class="annot"><span class="annottext">(Skeleton -&gt; Skeleton -&gt; Skeleton)
-&gt; ((Skeleton, IdSet, LlStgRhs) -&gt; Skeleton)
-&gt; (Skeleton, IdSet, LlStgRhs)
-&gt; Skeleton
-&gt; Skeleton
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Skeleton, IdSet, LlStgRhs) -&gt; Skeleton
forall a b c. (a, b, c) -&gt; a
</span><a href="GHC.Utils.Misc.html#fstOf3"><span class="hs-identifier hs-var">fstOf3</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053695"><span class="hs-identifier hs-var">body_skel</span></a></span><span> </span><span class="annot"><span class="annottext">[(Skeleton, IdSet, LlStgRhs)]
</span><a href="#local-6989586621681053685"><span class="hs-identifier hs-var">skel_occs_rhss'</span></a></span><span>
</span><span id="line-313"></span><span>    </span><span class="hs-comment">-- Now we can build the actual Skeleton for the expression just by</span><span>
</span><span id="line-314"></span><span>    </span><span class="hs-comment">-- iterating over each bind pair.</span><span>
</span><span id="line-315"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053678"><span class="annot"><span class="annottext">[Skeleton]
</span><a href="#local-6989586621681053678"><span class="hs-identifier hs-var">bind_skels</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053688"><span class="annot"><span class="annottext">[(BinderInfo, LlStgRhs)]
</span><a href="#local-6989586621681053688"><span class="hs-identifier hs-var">pairs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Skeleton, (BinderInfo, LlStgRhs))]
-&gt; ([Skeleton], [(BinderInfo, LlStgRhs)])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Id
 -&gt; (Skeleton, IdSet, LlStgRhs)
 -&gt; (Skeleton, (BinderInfo, LlStgRhs)))
-&gt; [Id]
-&gt; [(Skeleton, IdSet, LlStgRhs)]
-&gt; [(Skeleton, (BinderInfo, LlStgRhs))]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Id
-&gt; (Skeleton, IdSet, LlStgRhs)
-&gt; (Skeleton, (BinderInfo, LlStgRhs))
</span><a href="#local-6989586621681053676"><span class="hs-identifier hs-var">single_bind</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053687"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">[(Skeleton, IdSet, LlStgRhs)]
</span><a href="#local-6989586621681053685"><span class="hs-identifier hs-var">skel_occs_rhss'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-316"></span><span>    </span><span id="local-6989586621681053691"><span class="annot"><span class="annottext">let_skel :: Skeleton
</span><a href="#local-6989586621681053691"><span class="hs-identifier hs-var hs-var">let_skel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Skeleton -&gt; Skeleton -&gt; Skeleton)
-&gt; Skeleton -&gt; [Skeleton] -&gt; Skeleton
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#bothSk"><span class="hs-identifier hs-var">bothSk</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053695"><span class="hs-identifier hs-var">body_skel</span></a></span><span> </span><span class="annot"><span class="annottext">[Skeleton]
</span><a href="#local-6989586621681053678"><span class="hs-identifier hs-var">bind_skels</span></a></span><span>
</span><span id="line-317"></span><span>    </span><span id="local-6989586621681053676"><span class="annot"><span class="annottext">single_bind :: Id
-&gt; (Skeleton, IdSet, LlStgRhs)
-&gt; (Skeleton, (BinderInfo, LlStgRhs))
</span><a href="#local-6989586621681053676"><span class="hs-identifier hs-var hs-var">single_bind</span></a></span></span><span> </span><span id="local-6989586621681053675"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053675"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681053674"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053674"><span class="hs-identifier hs-var">skel_rhs</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053673"><span class="annot"><span class="annottext">LlStgRhs
</span><a href="#local-6989586621681053673"><span class="hs-identifier hs-var">rhs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053672"><span class="hs-identifier hs-var">bind_skel</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BinderInfo
</span><a href="#local-6989586621681053671"><span class="hs-identifier hs-var">bndr'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlStgRhs
</span><a href="#local-6989586621681053673"><span class="hs-identifier hs-var">rhs'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-319"></span><span>        </span><span class="hs-comment">-- Here, we finally add the closure around each @skel_rhs@.</span><span>
</span><span id="line-320"></span><span>        </span><span id="local-6989586621681053672"><span class="annot"><span class="annottext">bind_skel :: Skeleton
</span><a href="#local-6989586621681053672"><span class="hs-identifier hs-var hs-var">bind_skel</span></a></span></span><span>
</span><span id="line-321"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053696"><span class="hs-identifier hs-var">is_lne</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053674"><span class="hs-identifier hs-var">skel_rhs</span></a></span><span> </span><span class="hs-comment">-- no closure is allocated for let-no-escapes</span><span>
</span><span id="line-322"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; DIdSet -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#ClosureSk"><span class="hs-identifier hs-var">ClosureSk</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053675"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053670"><span class="hs-identifier hs-var">fvs</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053674"><span class="hs-identifier hs-var">skel_rhs</span></a></span><span>
</span><span id="line-323"></span><span>        </span><span id="local-6989586621681053670"><span class="annot"><span class="annottext">fvs :: DIdSet
</span><a href="#local-6989586621681053670"><span class="hs-identifier hs-var hs-var">fvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlStgRhs -&gt; DIdSet
forall (pass :: StgPass).
(XRhsClosure pass ~ DIdSet) =&gt;
GenStgRhs pass -&gt; DIdSet
</span><a href="GHC.Stg.Lift.Analysis.html#freeVarsOfRhs"><span class="hs-identifier hs-var">freeVarsOfRhs</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgRhs
</span><a href="#local-6989586621681053673"><span class="hs-identifier hs-var">rhs'</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; IdSet -&gt; DIdSet
</span><a href="GHC.Types.Var.Set.html#dVarSetMinusVarSet"><span class="hs-operator hs-var">`dVarSetMinusVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#mkVarSet"><span class="hs-identifier hs-var">mkVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053687"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-324"></span><span>        </span><span id="local-6989586621681053671"><span class="annot"><span class="annottext">bndr' :: BinderInfo
</span><a href="#local-6989586621681053671"><span class="hs-identifier hs-var hs-var">bndr'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Bool -&gt; BinderInfo
</span><a href="GHC.Stg.Lift.Analysis.html#BindsClosure"><span class="hs-identifier hs-var">BindsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053675"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053675"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; IdSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053681"><span class="hs-identifier hs-var">scope_occs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonRhs"><span class="hs-identifier hs-type">tagSkeletonRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgRhs"><span class="hs-identifier hs-type">CgStgRhs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgRhs"><span class="hs-identifier hs-type">LlStgRhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-327"></span><span id="tagSkeletonRhs"><span class="annot"><span class="annottext">tagSkeletonRhs :: Id -&gt; GenStgRhs 'CodeGen -&gt; (Skeleton, IdSet, LlStgRhs)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonRhs"><span class="hs-identifier hs-var hs-var">tagSkeletonRhs</span></a></span></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-type">StgRhsCon</span></a></span><span> </span><span id="local-6989586621681053667"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681053667"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span id="local-6989586621681053666"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681053666"><span class="hs-identifier hs-var">dc</span></a></span></span><span> </span><span id="local-6989586621681053665"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053665"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-328"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; IdSet
</span><a href="GHC.Stg.Lift.Analysis.html#mkArgOccs"><span class="hs-identifier hs-var">mkArgOccs</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053665"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CostCentreStack -&gt; DataCon -&gt; [StgArg] -&gt; LlStgRhs
forall (pass :: StgPass).
CostCentreStack -&gt; DataCon -&gt; [StgArg] -&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-var">StgRhsCon</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681053667"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681053666"><span class="hs-identifier hs-var">dc</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053665"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-329"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonRhs"><span class="hs-identifier hs-var">tagSkeletonRhs</span></a></span><span> </span><span id="local-6989586621681053664"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053664"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-type">StgRhsClosure</span></a></span><span> </span><span id="local-6989586621681053663"><span class="annot"><span class="annottext">XRhsClosure 'CodeGen
</span><a href="#local-6989586621681053663"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span id="local-6989586621681053662"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681053662"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span id="local-6989586621681053661"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681053661"><span class="hs-identifier hs-var">upd</span></a></span></span><span> </span><span id="local-6989586621681053660"><span class="annot"><span class="annottext">[BinderP 'CodeGen]
</span><a href="#local-6989586621681053660"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span> </span><span id="local-6989586621681053659"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053659"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053658"><span class="hs-identifier hs-var">rhs_skel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053657"><span class="hs-identifier hs-var">body_arg_occs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'LiftLams
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP 'LiftLams]
-&gt; LlStgExpr
-&gt; LlStgRhs
forall (pass :: StgPass).
XRhsClosure pass
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP pass]
-&gt; GenStgExpr pass
-&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-var">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'CodeGen
XRhsClosure 'LiftLams
</span><a href="#local-6989586621681053663"><span class="hs-identifier hs-var">fvs</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681053662"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681053661"><span class="hs-identifier hs-var">upd</span></a></span><span> </span><span class="annot"><span class="annottext">[BinderP 'LiftLams]
[BinderInfo]
</span><a href="#local-6989586621681053656"><span class="hs-identifier hs-var">bndrs'</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053655"><span class="hs-identifier hs-var">body'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-332"></span><span>    </span><span id="local-6989586621681053656"><span class="annot"><span class="annottext">bndrs' :: [BinderInfo]
</span><a href="#local-6989586621681053656"><span class="hs-identifier hs-var hs-var">bndrs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; BinderInfo) -&gt; [Id] -&gt; [BinderInfo]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; BinderInfo
</span><a href="GHC.Stg.Lift.Analysis.html#BoringBinder"><span class="hs-identifier hs-var">BoringBinder</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[BinderP 'CodeGen]
</span><a href="#local-6989586621681053660"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-333"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053654"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053654"><span class="hs-identifier hs-var">body_skel</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053657"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053657"><span class="hs-identifier hs-var">body_arg_occs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053655"><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053655"><span class="hs-identifier hs-var">body'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053659"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-334"></span><span>    </span><span id="local-6989586621681053658"><span class="annot"><span class="annottext">rhs_skel :: Skeleton
</span><a href="#local-6989586621681053658"><span class="hs-identifier hs-var hs-var">rhs_skel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; Skeleton -&gt; Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#rhsSk"><span class="hs-identifier hs-var">rhsSk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; DmdShell
</span><a href="GHC.Stg.Lift.Analysis.html#rhsDmdShell"><span class="hs-identifier hs-var">rhsDmdShell</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053664"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053654"><span class="hs-identifier hs-var">body_skel</span></a></span><span>
</span><span id="line-335"></span><span>
</span><span id="line-336"></span><span class="hs-comment">-- | How many times will the lambda body of the RHS bound to the given</span><span>
</span><span id="line-337"></span><span class="hs-comment">-- identifier be evaluated, relative to its defining context? This function</span><span>
</span><span id="line-338"></span><span class="hs-comment">-- computes the answer in form of a 'DmdShell'.</span><span>
</span><span id="line-339"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#rhsDmdShell"><span class="hs-identifier hs-type">rhsDmdShell</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span>
</span><span id="line-340"></span><span id="rhsDmdShell"><span class="annot"><span class="annottext">rhsDmdShell :: Id -&gt; DmdShell
</span><a href="GHC.Stg.Lift.Analysis.html#rhsDmdShell"><span class="hs-identifier hs-var hs-var">rhsDmdShell</span></a></span></span><span> </span><span id="local-6989586621681053652"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053652"><span class="hs-identifier hs-var">bndr</span></a></span></span><span>
</span><span id="line-341"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053651"><span class="hs-identifier hs-var">is_thunk</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; DmdShell
forall s u. JointDmd s (Use u) -&gt; JointDmd s (Use u)
</span><a href="GHC.Types.Demand.html#oneifyDmd"><span class="hs-identifier hs-var">oneifyDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053649"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-342"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; CleanDemand -&gt; DmdShell
</span><a href="GHC.Types.Demand.html#peelManyCalls"><span class="hs-identifier hs-var">peelManyCalls</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Int
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053652"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621681053646"><span class="hs-identifier hs-var">cd</span></a></span><span>
</span><span id="line-343"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-344"></span><span>    </span><span id="local-6989586621681053651"><span class="annot"><span class="annottext">is_thunk :: Bool
</span><a href="#local-6989586621681053651"><span class="hs-identifier hs-var hs-var">is_thunk</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Int
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053652"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-345"></span><span>    </span><span class="hs-comment">-- Let's pray idDemandInfo is still OK after unarise...</span><span>
</span><span id="line-346"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053649"><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053649"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053646"><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621681053646"><span class="hs-identifier hs-var">cd</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand -&gt; (DmdShell, CleanDemand)
</span><a href="GHC.Types.Demand.html#toCleanDmd"><span class="hs-identifier hs-var">toCleanDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Demand
</span><a href="GHC.Types.Id.html#idDemandInfo"><span class="hs-identifier hs-var">idDemandInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053652"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-347"></span><span>
</span><span id="line-348"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonAlt"><span class="hs-identifier hs-type">tagSkeletonAlt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgAlt"><span class="hs-identifier hs-type">CgStgAlt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgAlt"><span class="hs-identifier hs-type">LlStgAlt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-349"></span><span id="tagSkeletonAlt"><span class="annot"><span class="annottext">tagSkeletonAlt :: GenStgAlt 'CodeGen -&gt; (Skeleton, IdSet, GenStgAlt 'LiftLams)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonAlt"><span class="hs-identifier hs-var hs-var">tagSkeletonAlt</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681053642"><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621681053642"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053641"><span class="annot"><span class="annottext">[BinderP 'CodeGen]
</span><a href="#local-6989586621681053641"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053640"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053640"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-350"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053639"><span class="hs-identifier hs-var">alt_skel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053638"><span class="hs-identifier hs-var">arg_occs</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621681053642"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; BinderInfo) -&gt; [Id] -&gt; [BinderInfo]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; BinderInfo
</span><a href="GHC.Stg.Lift.Analysis.html#BoringBinder"><span class="hs-identifier hs-var">BoringBinder</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[BinderP 'CodeGen]
</span><a href="#local-6989586621681053641"><span class="hs-identifier hs-var">bndrs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053637"><span class="hs-identifier hs-var">rhs'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-351"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-352"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053639"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053639"><span class="hs-identifier hs-var">alt_skel</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053636"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053636"><span class="hs-identifier hs-var">alt_arg_occs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053637"><span class="annot"><span class="annottext">LlStgExpr
</span><a href="#local-6989586621681053637"><span class="hs-identifier hs-var">rhs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; (Skeleton, IdSet, LlStgExpr)
</span><a href="GHC.Stg.Lift.Analysis.html#tagSkeletonExpr"><span class="hs-identifier hs-var">tagSkeletonExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681053640"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-353"></span><span>    </span><span id="local-6989586621681053638"><span class="annot"><span class="annottext">arg_occs :: IdSet
</span><a href="#local-6989586621681053638"><span class="hs-identifier hs-var hs-var">arg_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053636"><span class="hs-identifier hs-var">alt_arg_occs</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet -&gt; [Id] -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#delVarSetList"><span class="hs-operator hs-var">`delVarSetList`</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[BinderP 'CodeGen]
</span><a href="#local-6989586621681053641"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-354"></span><span>
</span><span id="line-355"></span><span class="hs-comment">-- | Combines several heuristics to decide whether to lambda-lift a given</span><span>
</span><span id="line-356"></span><span class="hs-comment">-- @let@-binding to top-level. See &quot;GHC.Stg.Lift.Analysis#when&quot; for details.</span><span>
</span><span id="line-357"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#goodToLift"><span class="hs-identifier hs-type">goodToLift</span></a></span><span>
</span><span id="line-358"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-359"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span>
</span><span id="line-360"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span>
</span><span id="line-361"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ An expander function, turning 'InId's into</span><span>
</span><span id="line-362"></span><span>                        </span><span class="hs-comment">-- 'OutId's. See 'GHC.Stg.Lift.Monad.liftedIdsExpander'.</span><span>
</span><span id="line-363"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BinderInfo"><span class="hs-identifier hs-type">BinderInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgRhs"><span class="hs-identifier hs-type">LlStgRhs</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-364"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-365"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span>       </span><span class="hs-comment">-- ^ @Just abs_ids@ &lt;=&gt; This binding is beneficial to</span><span>
</span><span id="line-366"></span><span>                        </span><span class="hs-comment">-- lift and @abs_ids@ are the variables it would</span><span>
</span><span id="line-367"></span><span>                        </span><span class="hs-comment">-- abstract over</span><span>
</span><span id="line-368"></span><span id="goodToLift"><span class="annot"><span class="annottext">goodToLift :: DynFlags
-&gt; TopLevelFlag
-&gt; RecFlag
-&gt; (DIdSet -&gt; DIdSet)
-&gt; [(BinderInfo, LlStgRhs)]
-&gt; Skeleton
-&gt; Maybe DIdSet
</span><a href="GHC.Stg.Lift.Analysis.html#goodToLift"><span class="hs-identifier hs-var hs-var">goodToLift</span></a></span></span><span> </span><span id="local-6989586621681053635"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053635"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681053634"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681053634"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681053633"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681053633"><span class="hs-identifier hs-var">rec_flag</span></a></span></span><span> </span><span id="local-6989586621681053632"><span class="annot"><span class="annottext">DIdSet -&gt; DIdSet
</span><a href="#local-6989586621681053632"><span class="hs-identifier hs-var">expander</span></a></span></span><span> </span><span id="local-6989586621681053631"><span class="annot"><span class="annottext">[(BinderInfo, LlStgRhs)]
</span><a href="#local-6989586621681053631"><span class="hs-identifier hs-var">pairs</span></a></span></span><span> </span><span id="local-6989586621681053630"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053630"><span class="hs-identifier hs-var">scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(String, Bool)] -&gt; Maybe DIdSet
</span><a href="#local-6989586621681053629"><span class="hs-identifier hs-var">decide</span></a></span><span>
</span><span id="line-369"></span><span>  </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;top-level&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#isTopLevel"><span class="hs-identifier hs-var">isTopLevel</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681053634"><span class="hs-identifier hs-var">top_lvl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- keep in sync with Note [When to lift]</span><span>
</span><span id="line-370"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memoized&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053627"><span class="hs-identifier hs-var">any_memoized</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-371"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;argument occurrences&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053626"><span class="hs-identifier hs-var">arg_occs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-372"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;join point&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053625"><span class="hs-identifier hs-var">is_join_point</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-373"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;abstracts join points&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053624"><span class="hs-identifier hs-var">abstracts_join_ids</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-374"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;abstracts known local function&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053623"><span class="hs-identifier hs-var">abstracts_known_local_fun</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-375"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;args spill on stack&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053622"><span class="hs-identifier hs-var">args_spill_on_stack</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-376"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;increases allocation&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053621"><span class="hs-identifier hs-var">inc_allocs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-377"></span><span>  </span><span class="hs-special">]</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-378"></span><span>      </span><span id="local-6989586621681053620"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681053620"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053635"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-379"></span><span>      </span><span id="local-6989586621681053629"><span class="annot"><span class="annottext">decide :: [(String, Bool)] -&gt; Maybe DIdSet
</span><a href="#local-6989586621681053629"><span class="hs-identifier hs-var hs-var">decide</span></a></span></span><span> </span><span id="local-6989586621681053618"><span class="annot"><span class="annottext">[(String, Bool)]
</span><a href="#local-6989586621681053618"><span class="hs-identifier hs-var">deciders</span></a></span></span><span>
</span><span id="line-380"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(String, Bool)] -&gt; Bool
</span><a href="#local-6989586621681053616"><span class="hs-identifier hs-var">fancy_or</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, Bool)]
</span><a href="#local-6989586621681053618"><span class="hs-identifier hs-var">deciders</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-381"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Maybe DIdSet -&gt; Maybe DIdSet
forall a. String -&gt; SDoc -&gt; a -&gt; a
</span><a href="GHC.Stg.Lift.Analysis.html#llTrace"><span class="hs-identifier hs-var">llTrace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;stgLiftLams:lifting&quot;</span></span><span>
</span><span id="line-382"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053615"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053614"><span class="hs-identifier hs-var">abs_ids</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-383"></span><span>                   </span><span class="annot"><span class="annottext">IntWithInf -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><a href="#local-6989586621681053613"><span class="hs-identifier hs-var">allocs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-384"></span><span>                   </span><span class="annot"><span class="annottext">Skeleton -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053630"><span class="hs-identifier hs-var">scope</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Maybe DIdSet -&gt; Maybe DIdSet) -&gt; Maybe DIdSet -&gt; Maybe DIdSet
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-385"></span><span>          </span><span class="annot"><span class="annottext">DIdSet -&gt; Maybe DIdSet
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053614"><span class="hs-identifier hs-var">abs_ids</span></a></span><span>
</span><span id="line-386"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-387"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe DIdSet
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-388"></span><span>      </span><span id="local-6989586621681053612"><span class="annot"><span class="annottext">ppr_deciders :: [(String, Bool)] -&gt; SDoc
</span><a href="#local-6989586621681053612"><span class="hs-identifier hs-var hs-var">ppr_deciders</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="annot"><span class="annottext">([SDoc] -&gt; SDoc)
-&gt; ([(String, Bool)] -&gt; [SDoc]) -&gt; [(String, Bool)] -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">((String, Bool) -&gt; SDoc) -&gt; [(String, Bool)] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; SDoc)
-&gt; ((String, Bool) -&gt; String) -&gt; (String, Bool) -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(String, Bool) -&gt; String
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([(String, Bool)] -&gt; [SDoc])
-&gt; ([(String, Bool)] -&gt; [(String, Bool)])
-&gt; [(String, Bool)]
-&gt; [SDoc]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">((String, Bool) -&gt; Bool) -&gt; [(String, Bool)] -&gt; [(String, Bool)]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">(String, Bool) -&gt; Bool
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span>
</span><span id="line-389"></span><span>      </span><span id="local-6989586621681053616"><span class="annot"><span class="annottext">fancy_or :: [(String, Bool)] -&gt; Bool
</span><a href="#local-6989586621681053616"><span class="hs-identifier hs-var hs-var">fancy_or</span></a></span></span><span> </span><span id="local-6989586621681053611"><span class="annot"><span class="annottext">[(String, Bool)]
</span><a href="#local-6989586621681053611"><span class="hs-identifier hs-var">deciders</span></a></span></span><span>
</span><span id="line-390"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Bool -&gt; Bool
forall a. String -&gt; SDoc -&gt; a -&gt; a
</span><a href="GHC.Stg.Lift.Analysis.html#llTrace"><span class="hs-identifier hs-var">llTrace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;stgLiftLams:goodToLift&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053615"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, Bool)] -&gt; SDoc
</span><a href="#local-6989586621681053612"><span class="hs-identifier hs-var">ppr_deciders</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, Bool)]
</span><a href="#local-6989586621681053611"><span class="hs-identifier hs-var">deciders</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-391"></span><span>          </span><span class="annot"><span class="annottext">((String, Bool) -&gt; Bool) -&gt; [(String, Bool)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">(String, Bool) -&gt; Bool
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, Bool)]
</span><a href="#local-6989586621681053611"><span class="hs-identifier hs-var">deciders</span></a></span><span>
</span><span id="line-392"></span><span>
</span><span id="line-393"></span><span>      </span><span id="local-6989586621681053615"><span class="annot"><span class="annottext">bndrs :: [Id]
</span><a href="#local-6989586621681053615"><span class="hs-identifier hs-var hs-var">bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((BinderInfo, LlStgRhs) -&gt; Id) -&gt; [(BinderInfo, LlStgRhs)] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BinderInfo -&gt; Id
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var">binderInfoBndr</span></a></span><span> </span><span class="annot"><span class="annottext">(BinderInfo -&gt; Id)
-&gt; ((BinderInfo, LlStgRhs) -&gt; BinderInfo)
-&gt; (BinderInfo, LlStgRhs)
-&gt; Id
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(BinderInfo, LlStgRhs) -&gt; BinderInfo
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(BinderInfo, LlStgRhs)]
</span><a href="#local-6989586621681053631"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-394"></span><span>      </span><span id="local-6989586621681053609"><span class="annot"><span class="annottext">bndrs_set :: IdSet
</span><a href="#local-6989586621681053609"><span class="hs-identifier hs-var hs-var">bndrs_set</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; IdSet
</span><a href="GHC.Types.Var.Set.html#mkVarSet"><span class="hs-identifier hs-var">mkVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053615"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-395"></span><span>      </span><span id="local-6989586621681053608"><span class="annot"><span class="annottext">rhss :: [LlStgRhs]
</span><a href="#local-6989586621681053608"><span class="hs-identifier hs-var hs-var">rhss</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((BinderInfo, LlStgRhs) -&gt; LlStgRhs)
-&gt; [(BinderInfo, LlStgRhs)] -&gt; [LlStgRhs]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(BinderInfo, LlStgRhs) -&gt; LlStgRhs
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(BinderInfo, LlStgRhs)]
</span><a href="#local-6989586621681053631"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-396"></span><span>
</span><span id="line-397"></span><span>      </span><span class="hs-comment">-- First objective: Calculate @abs_ids@, e.g. the former free variables</span><span>
</span><span id="line-398"></span><span>      </span><span class="hs-comment">-- the lifted binding would abstract over. We have to merge the free</span><span>
</span><span id="line-399"></span><span>      </span><span class="hs-comment">-- variables of all RHS to get the set of variables that will have to be</span><span>
</span><span id="line-400"></span><span>      </span><span class="hs-comment">-- passed through parameters.</span><span>
</span><span id="line-401"></span><span>      </span><span id="local-6989586621681053607"><span class="annot"><span class="annottext">fvs :: DIdSet
</span><a href="#local-6989586621681053607"><span class="hs-identifier hs-var hs-var">fvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[DIdSet] -&gt; DIdSet
</span><a href="GHC.Types.Var.Set.html#unionDVarSets"><span class="hs-identifier hs-var">unionDVarSets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LlStgRhs -&gt; DIdSet) -&gt; [LlStgRhs] -&gt; [DIdSet]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgRhs -&gt; DIdSet
forall (pass :: StgPass).
(XRhsClosure pass ~ DIdSet) =&gt;
GenStgRhs pass -&gt; DIdSet
</span><a href="GHC.Stg.Lift.Analysis.html#freeVarsOfRhs"><span class="hs-identifier hs-var">freeVarsOfRhs</span></a></span><span> </span><span class="annot"><span class="annottext">[LlStgRhs]
</span><a href="#local-6989586621681053608"><span class="hs-identifier hs-var">rhss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-402"></span><span>      </span><span class="hs-comment">-- To lift the binding to top-level, we want to delete the lifted binders</span><span>
</span><span id="line-403"></span><span>      </span><span class="hs-comment">-- themselves from the free var set. Local let bindings track recursive</span><span>
</span><span id="line-404"></span><span>      </span><span class="hs-comment">-- occurrences in their free variable set. We neither want to apply our</span><span>
</span><span id="line-405"></span><span>      </span><span class="hs-comment">-- cost model to them (see 'tagSkeletonRhs'), nor pass them as parameters</span><span>
</span><span id="line-406"></span><span>      </span><span class="hs-comment">-- when lifted, as these are known calls. We call the resulting set the</span><span>
</span><span id="line-407"></span><span>      </span><span class="hs-comment">-- identifiers we abstract over, thus @abs_ids@. These are all 'OutId's.</span><span>
</span><span id="line-408"></span><span>      </span><span class="hs-comment">-- We will save the set in 'LiftM.e_expansions' for each of the variables</span><span>
</span><span id="line-409"></span><span>      </span><span class="hs-comment">-- if we perform the lift.</span><span>
</span><span id="line-410"></span><span>      </span><span id="local-6989586621681053614"><span class="annot"><span class="annottext">abs_ids :: DIdSet
</span><a href="#local-6989586621681053614"><span class="hs-identifier hs-var hs-var">abs_ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; DIdSet
</span><a href="#local-6989586621681053632"><span class="hs-identifier hs-var">expander</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DIdSet -&gt; [Id] -&gt; DIdSet
</span><a href="GHC.Types.Var.Set.html#delDVarSetList"><span class="hs-identifier hs-var">delDVarSetList</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053607"><span class="hs-identifier hs-var">fvs</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053615"><span class="hs-identifier hs-var">bndrs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-411"></span><span>
</span><span id="line-412"></span><span>      </span><span class="hs-comment">-- We don't lift updatable thunks or constructors</span><span>
</span><span id="line-413"></span><span>      </span><span id="local-6989586621681053627"><span class="annot"><span class="annottext">any_memoized :: Bool
</span><a href="#local-6989586621681053627"><span class="hs-identifier hs-var hs-var">any_memoized</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlStgRhs -&gt; Bool) -&gt; [LlStgRhs] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgRhs -&gt; Bool
forall {pass :: StgPass}. GenStgRhs pass -&gt; Bool
</span><a href="#local-6989586621681053604"><span class="hs-identifier hs-var">is_memoized_rhs</span></a></span><span> </span><span class="annot"><span class="annottext">[LlStgRhs]
</span><a href="#local-6989586621681053608"><span class="hs-identifier hs-var">rhss</span></a></span><span>
</span><span id="line-414"></span><span>      </span><span id="local-6989586621681053604"><span class="annot"><span class="annottext">is_memoized_rhs :: GenStgRhs pass -&gt; Bool
</span><a href="#local-6989586621681053604"><span class="hs-identifier hs-var hs-var">is_memoized_rhs</span></a></span></span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-type">StgRhsCon</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-415"></span><span>      </span><span class="annot"><a href="#local-6989586621681053604"><span class="hs-identifier hs-var">is_memoized_rhs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-type">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">XRhsClosure pass
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681053603"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681053603"><span class="hs-identifier hs-var">upd</span></a></span></span><span> </span><span class="annot"><span class="annottext">[BinderP pass]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">GenStgExpr pass
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UpdateFlag -&gt; Bool
</span><a href="GHC.Stg.Syntax.html#isUpdatable"><span class="hs-identifier hs-var">isUpdatable</span></a></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681053603"><span class="hs-identifier hs-var">upd</span></a></span><span>
</span><span id="line-416"></span><span>
</span><span id="line-417"></span><span>      </span><span class="hs-comment">-- Don't lift binders occurring as arguments. This would result in complex</span><span>
</span><span id="line-418"></span><span>      </span><span class="hs-comment">-- argument expressions which would have to be given a name, reintroducing</span><span>
</span><span id="line-419"></span><span>      </span><span class="hs-comment">-- the very allocation at each call site that we wanted to get rid off in</span><span>
</span><span id="line-420"></span><span>      </span><span class="hs-comment">-- the first place.</span><span>
</span><span id="line-421"></span><span>      </span><span id="local-6989586621681053626"><span class="annot"><span class="annottext">arg_occs :: Bool
</span><a href="#local-6989586621681053626"><span class="hs-identifier hs-var hs-var">arg_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; Bool
forall (t :: * -&gt; *). Foldable t =&gt; t Bool -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#or"><span class="hs-identifier hs-var">or</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((BinderInfo, LlStgRhs) -&gt; Maybe Bool)
-&gt; [(BinderInfo, LlStgRhs)] -&gt; [Bool]
forall a b. (a -&gt; Maybe b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier hs-var">mapMaybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BinderInfo -&gt; Maybe Bool
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoOccursAsArg"><span class="hs-identifier hs-var">binderInfoOccursAsArg</span></a></span><span> </span><span class="annot"><span class="annottext">(BinderInfo -&gt; Maybe Bool)
-&gt; ((BinderInfo, LlStgRhs) -&gt; BinderInfo)
-&gt; (BinderInfo, LlStgRhs)
-&gt; Maybe Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(BinderInfo, LlStgRhs) -&gt; BinderInfo
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(BinderInfo, LlStgRhs)]
</span><a href="#local-6989586621681053631"><span class="hs-identifier hs-var">pairs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-422"></span><span>
</span><span id="line-423"></span><span>      </span><span class="hs-comment">-- These don't allocate anyway.</span><span>
</span><span id="line-424"></span><span>      </span><span id="local-6989586621681053625"><span class="annot"><span class="annottext">is_join_point :: Bool
</span><a href="#local-6989586621681053625"><span class="hs-identifier hs-var hs-var">is_join_point</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Bool) -&gt; [Id] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Bool
</span><a href="GHC.Types.Id.html#isJoinId"><span class="hs-identifier hs-var">isJoinId</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053615"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-425"></span><span>
</span><span id="line-426"></span><span>      </span><span class="hs-comment">-- Abstracting over join points/let-no-escapes spoils them.</span><span>
</span><span id="line-427"></span><span>      </span><span id="local-6989586621681053624"><span class="annot"><span class="annottext">abstracts_join_ids :: Bool
</span><a href="#local-6989586621681053624"><span class="hs-identifier hs-var hs-var">abstracts_join_ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Bool) -&gt; [Id] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Bool
</span><a href="GHC.Types.Id.html#isJoinId"><span class="hs-identifier hs-var">isJoinId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DIdSet -&gt; [Id]
</span><a href="GHC.Types.Var.Set.html#dVarSetElems"><span class="hs-identifier hs-var">dVarSetElems</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053614"><span class="hs-identifier hs-var">abs_ids</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-428"></span><span>
</span><span id="line-429"></span><span>      </span><span class="hs-comment">-- Abstracting over known local functions that aren't floated themselves</span><span>
</span><span id="line-430"></span><span>      </span><span class="hs-comment">-- turns a known, fast call into an unknown, slow call:</span><span>
</span><span id="line-431"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-432"></span><span>      </span><span class="hs-comment">--    let f x = ...</span><span>
</span><span id="line-433"></span><span>      </span><span class="hs-comment">--        g y = ... f x ... -- this was a known call</span><span>
</span><span id="line-434"></span><span>      </span><span class="hs-comment">--    in g 4</span><span>
</span><span id="line-435"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-436"></span><span>      </span><span class="hs-comment">-- After lifting @g@, but not @f@:</span><span>
</span><span id="line-437"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-438"></span><span>      </span><span class="hs-comment">--    l_g f y = ... f y ... -- this is now an unknown call</span><span>
</span><span id="line-439"></span><span>      </span><span class="hs-comment">--    let f x = ...</span><span>
</span><span id="line-440"></span><span>      </span><span class="hs-comment">--    in l_g f 4</span><span>
</span><span id="line-441"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-442"></span><span>      </span><span class="hs-comment">-- We can abuse the results of arity analysis for this:</span><span>
</span><span id="line-443"></span><span>      </span><span class="hs-comment">-- idArity f &gt; 0 ==&gt; known</span><span>
</span><span id="line-444"></span><span>      </span><span id="local-6989586621681053596"><span class="annot"><span class="annottext">known_fun :: Id -&gt; Bool
</span><a href="#local-6989586621681053596"><span class="hs-identifier hs-var hs-var">known_fun</span></a></span></span><span> </span><span id="local-6989586621681053595"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053595"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Int
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053595"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-445"></span><span>      </span><span id="local-6989586621681053623"><span class="annot"><span class="annottext">abstracts_known_local_fun :: Bool
</span><a href="#local-6989586621681053623"><span class="hs-identifier hs-var hs-var">abstracts_known_local_fun</span></a></span></span><span>
</span><span id="line-446"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#liftLamsKnown"><span class="hs-identifier hs-var hs-var">liftLamsKnown</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053635"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Bool) -&gt; [Id] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Bool
</span><a href="#local-6989586621681053596"><span class="hs-identifier hs-var">known_fun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DIdSet -&gt; [Id]
</span><a href="GHC.Types.Var.Set.html#dVarSetElems"><span class="hs-identifier hs-var">dVarSetElems</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053614"><span class="hs-identifier hs-var">abs_ids</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-447"></span><span>
</span><span id="line-448"></span><span>      </span><span class="hs-comment">-- Number of arguments of a RHS in the current binding group if we decide</span><span>
</span><span id="line-449"></span><span>      </span><span class="hs-comment">-- to lift it</span><span>
</span><span id="line-450"></span><span>      </span><span id="local-6989586621681053591"><span class="annot"><span class="annottext">n_args :: LlStgRhs -&gt; Int
</span><a href="#local-6989586621681053591"><span class="hs-identifier hs-var hs-var">n_args</span></a></span></span><span>
</span><span id="line-451"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[NonVoid Id] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span>
</span><span id="line-452"></span><span>        </span><span class="annot"><span class="annottext">([NonVoid Id] -&gt; Int)
-&gt; (LlStgRhs -&gt; [NonVoid Id]) -&gt; LlStgRhs -&gt; Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [NonVoid Id]
</span><a href="GHC.StgToCmm.Closure.html#nonVoidIds"><span class="hs-identifier hs-var">StgToCmm.Closure.nonVoidIds</span></a></span><span> </span><span class="hs-comment">-- void parameters don't appear in Cmm</span><span>
</span><span id="line-453"></span><span>        </span><span class="annot"><span class="annottext">([Id] -&gt; [NonVoid Id])
-&gt; (LlStgRhs -&gt; [Id]) -&gt; LlStgRhs -&gt; [NonVoid Id]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DIdSet -&gt; [Id]
</span><a href="GHC.Types.Var.Set.html#dVarSetElems"><span class="hs-identifier hs-var">dVarSetElems</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053614"><span class="hs-identifier hs-var">abs_ids</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Id] -&gt; [Id]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-454"></span><span>        </span><span class="annot"><span class="annottext">([Id] -&gt; [Id]) -&gt; (LlStgRhs -&gt; [Id]) -&gt; LlStgRhs -&gt; [Id]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgRhs -&gt; [Id]
</span><a href="GHC.Stg.Lift.Analysis.html#rhsLambdaBndrs"><span class="hs-identifier hs-var">rhsLambdaBndrs</span></a></span><span>
</span><span id="line-455"></span><span>      </span><span id="local-6989586621681053587"><span class="annot"><span class="annottext">max_n_args :: Maybe Int
</span><a href="#local-6989586621681053587"><span class="hs-identifier hs-var hs-var">max_n_args</span></a></span></span><span>
</span><span id="line-456"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">RecFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#isRec"><span class="hs-identifier hs-var">isRec</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681053633"><span class="hs-identifier hs-var">rec_flag</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Maybe Int
</span><a href="GHC.Driver.Session.html#liftLamsRecArgs"><span class="hs-identifier hs-var hs-var">liftLamsRecArgs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053635"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-457"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Maybe Int
</span><a href="GHC.Driver.Session.html#liftLamsNonRecArgs"><span class="hs-identifier hs-var hs-var">liftLamsNonRecArgs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053635"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-458"></span><span>      </span><span class="hs-comment">-- We have 5 hardware registers on x86_64 to pass arguments in. Any excess</span><span>
</span><span id="line-459"></span><span>      </span><span class="hs-comment">-- args are passed on the stack, which means slow memory accesses</span><span>
</span><span id="line-460"></span><span>      </span><span id="local-6989586621681053622"><span class="annot"><span class="annottext">args_spill_on_stack :: Bool
</span><a href="#local-6989586621681053622"><span class="hs-identifier hs-var hs-var">args_spill_on_stack</span></a></span></span><span>
</span><span id="line-461"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681053583"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053583"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621681053587"><span class="hs-identifier hs-var">max_n_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; Int
forall (t :: * -&gt; *) a. (Foldable t, Ord a) =&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#maximum"><span class="hs-identifier hs-var">maximum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LlStgRhs -&gt; Int) -&gt; [LlStgRhs] -&gt; [Int]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgRhs -&gt; Int
</span><a href="#local-6989586621681053591"><span class="hs-identifier hs-var">n_args</span></a></span><span> </span><span class="annot"><span class="annottext">[LlStgRhs]
</span><a href="#local-6989586621681053608"><span class="hs-identifier hs-var">rhss</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053583"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-462"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-463"></span><span>
</span><span id="line-464"></span><span>      </span><span class="hs-comment">-- We only perform the lift if allocations didn't increase.</span><span>
</span><span id="line-465"></span><span>      </span><span class="hs-comment">-- Note that @clo_growth@ will be 'infinity' if there was positive growth</span><span>
</span><span id="line-466"></span><span>      </span><span class="hs-comment">-- under a multi-shot lambda.</span><span>
</span><span id="line-467"></span><span>      </span><span class="hs-comment">-- Also, abstracting over LNEs is unacceptable. LNEs might return</span><span>
</span><span id="line-468"></span><span>      </span><span class="hs-comment">-- unlifted tuples, which idClosureFootprint can't cope with.</span><span>
</span><span id="line-469"></span><span>      </span><span id="local-6989586621681053621"><span class="annot"><span class="annottext">inc_allocs :: Bool
</span><a href="#local-6989586621681053621"><span class="hs-identifier hs-var hs-var">inc_allocs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053624"><span class="hs-identifier hs-var">abstracts_join_ids</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><a href="#local-6989586621681053613"><span class="hs-identifier hs-var">allocs</span></a></span><span> </span><span class="annot"><span class="annottext">IntWithInf -&gt; IntWithInf -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><span class="hs-number">0</span></span><span>
</span><span id="line-470"></span><span>      </span><span id="local-6989586621681053613"><span class="annot"><span class="annottext">allocs :: IntWithInf
</span><a href="#local-6989586621681053613"><span class="hs-identifier hs-var hs-var">allocs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><a href="#local-6989586621681053580"><span class="hs-identifier hs-var">clo_growth</span></a></span><span> </span><span class="annot"><span class="annottext">IntWithInf -&gt; IntWithInf -&gt; IntWithInf
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; IntWithInf
</span><a href="GHC.Types.Basic.html#mkIntWithInf"><span class="hs-identifier hs-var">mkIntWithInf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int
forall a. Num a =&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053577"><span class="hs-identifier hs-var">closuresSize</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-471"></span><span>      </span><span class="hs-comment">-- We calculate and then add up the size of each binding's closure.</span><span>
</span><span id="line-472"></span><span>      </span><span class="hs-comment">-- GHC does not currently share closure environments, and we either lift</span><span>
</span><span id="line-473"></span><span>      </span><span class="hs-comment">-- the entire recursive binding group or none of it.</span><span>
</span><span id="line-474"></span><span>      </span><span id="local-6989586621681053577"><span class="annot"><span class="annottext">closuresSize :: Int
</span><a href="#local-6989586621681053577"><span class="hs-identifier hs-var hs-var">closuresSize</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; Int
forall (t :: * -&gt; *) a. (Foldable t, Num a) =&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#sum"><span class="hs-identifier hs-var">sum</span></a></span><span> </span><span class="annot"><span class="annottext">([Int] -&gt; Int) -&gt; [Int] -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((LlStgRhs -&gt; Int) -&gt; [LlStgRhs] -&gt; [Int])
-&gt; [LlStgRhs] -&gt; (LlStgRhs -&gt; Int) -&gt; [Int]
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">(LlStgRhs -&gt; Int) -&gt; [LlStgRhs] -&gt; [Int]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">[LlStgRhs]
</span><a href="#local-6989586621681053608"><span class="hs-identifier hs-var">rhss</span></a></span><span> </span><span class="annot"><span class="annottext">((LlStgRhs -&gt; Int) -&gt; [Int]) -&gt; (LlStgRhs -&gt; Int) -&gt; [Int]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681053574"><span class="annot"><span class="annottext">LlStgRhs
</span><a href="#local-6989586621681053574"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-475"></span><span>        </span><span class="annot"><span class="annottext">DynFlags -&gt; [Id] -&gt; Int
</span><a href="GHC.Stg.Lift.Analysis.html#closureSize"><span class="hs-identifier hs-var">closureSize</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053635"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-476"></span><span>        </span><span class="annot"><span class="annottext">([Id] -&gt; Int) -&gt; (DIdSet -&gt; [Id]) -&gt; DIdSet -&gt; Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; [Id]
</span><a href="GHC.Types.Var.Set.html#dVarSetElems"><span class="hs-identifier hs-var">dVarSetElems</span></a></span><span>
</span><span id="line-477"></span><span>        </span><span class="annot"><span class="annottext">(DIdSet -&gt; [Id]) -&gt; (DIdSet -&gt; DIdSet) -&gt; DIdSet -&gt; [Id]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; DIdSet
</span><a href="#local-6989586621681053632"><span class="hs-identifier hs-var">expander</span></a></span><span>
</span><span id="line-478"></span><span>        </span><span class="annot"><span class="annottext">(DIdSet -&gt; DIdSet) -&gt; (DIdSet -&gt; DIdSet) -&gt; DIdSet -&gt; DIdSet
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(DIdSet -&gt; IdSet -&gt; DIdSet) -&gt; IdSet -&gt; DIdSet -&gt; DIdSet
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; IdSet -&gt; DIdSet
</span><a href="GHC.Types.Var.Set.html#dVarSetMinusVarSet"><span class="hs-identifier hs-var">dVarSetMinusVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053609"><span class="hs-identifier hs-var">bndrs_set</span></a></span><span>
</span><span id="line-479"></span><span>        </span><span class="annot"><span class="annottext">(DIdSet -&gt; Int) -&gt; DIdSet -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgRhs -&gt; DIdSet
forall (pass :: StgPass).
(XRhsClosure pass ~ DIdSet) =&gt;
GenStgRhs pass -&gt; DIdSet
</span><a href="GHC.Stg.Lift.Analysis.html#freeVarsOfRhs"><span class="hs-identifier hs-var">freeVarsOfRhs</span></a></span><span> </span><span class="annot"><span class="annottext">LlStgRhs
</span><a href="#local-6989586621681053574"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-480"></span><span>      </span><span id="local-6989586621681053580"><span class="annot"><span class="annottext">clo_growth :: IntWithInf
</span><a href="#local-6989586621681053580"><span class="hs-identifier hs-var hs-var">clo_growth</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DIdSet -&gt; DIdSet)
-&gt; (Id -&gt; Int) -&gt; IdSet -&gt; DIdSet -&gt; Skeleton -&gt; IntWithInf
</span><a href="GHC.Stg.Lift.Analysis.html#closureGrowth"><span class="hs-identifier hs-var">closureGrowth</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; DIdSet
</span><a href="#local-6989586621681053632"><span class="hs-identifier hs-var">expander</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Id -&gt; Int
</span><a href="GHC.Stg.Lift.Analysis.html#idClosureFootprint"><span class="hs-identifier hs-var">idClosureFootprint</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053620"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053609"><span class="hs-identifier hs-var">bndrs_set</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053614"><span class="hs-identifier hs-var">abs_ids</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053630"><span class="hs-identifier hs-var">scope</span></a></span><span>
</span><span id="line-481"></span><span>
</span><span id="line-482"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#rhsLambdaBndrs"><span class="hs-identifier hs-type">rhsLambdaBndrs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#LlStgRhs"><span class="hs-identifier hs-type">LlStgRhs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-483"></span><span id="rhsLambdaBndrs"><span class="annot"><span class="annottext">rhsLambdaBndrs :: LlStgRhs -&gt; [Id]
</span><a href="GHC.Stg.Lift.Analysis.html#rhsLambdaBndrs"><span class="hs-identifier hs-var hs-var">rhsLambdaBndrs</span></a></span></span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-type">StgRhsCon</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-484"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#rhsLambdaBndrs"><span class="hs-identifier hs-var">rhsLambdaBndrs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-type">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'LiftLams
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681053571"><span class="annot"><span class="annottext">[BinderP 'LiftLams]
</span><a href="#local-6989586621681053571"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span> </span><span class="annot"><span class="annottext">LlStgExpr
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(BinderInfo -&gt; Id) -&gt; [BinderInfo] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">BinderInfo -&gt; Id
</span><a href="GHC.Stg.Lift.Analysis.html#binderInfoBndr"><span class="hs-identifier hs-var">binderInfoBndr</span></a></span><span> </span><span class="annot"><span class="annottext">[BinderP 'LiftLams]
[BinderInfo]
</span><a href="#local-6989586621681053571"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-485"></span><span>
</span><span id="line-486"></span><span class="hs-comment">-- | The size in words of a function closure closing over the given 'Id's,</span><span>
</span><span id="line-487"></span><span class="hs-comment">-- including the header.</span><span>
</span><span id="line-488"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#closureSize"><span class="hs-identifier hs-type">closureSize</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span>
</span><span id="line-489"></span><span id="closureSize"><span class="annot"><span class="annottext">closureSize :: DynFlags -&gt; [Id] -&gt; Int
</span><a href="GHC.Stg.Lift.Analysis.html#closureSize"><span class="hs-identifier hs-var hs-var">closureSize</span></a></span></span><span> </span><span id="local-6989586621681053570"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053570"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681053569"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053569"><span class="hs-identifier hs-var">ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053568"><span class="hs-identifier hs-var">words</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Driver.Session.html#sTD_HDR_SIZE"><span class="hs-identifier hs-var">sTD_HDR_SIZE</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053570"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-490"></span><span>  </span><span class="hs-comment">-- We go through sTD_HDR_SIZE rather than fixedHdrSizeW so that we don't</span><span>
</span><span id="line-491"></span><span>  </span><span class="hs-comment">-- optimise differently when profiling is enabled.</span><span>
</span><span id="line-492"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-493"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053568"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053568"><span class="hs-identifier hs-var">words</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, Int)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-494"></span><span>      </span><span class="hs-comment">-- Functions have a StdHeader (as opposed to ThunkHeader).</span><span>
</span><span id="line-495"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, Id)]
-&gt; (Int, Int, [(NonVoid Id, Int)])
forall a.
DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (Int, Int, [(NonVoid a, Int)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsets"><span class="hs-identifier hs-var">StgToCmm.Layout.mkVirtHeapOffsets</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053570"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#StdHeader"><span class="hs-identifier hs-var">StgToCmm.Layout.StdHeader</span></a></span><span>
</span><span id="line-496"></span><span>      </span><span class="annot"><span class="annottext">([NonVoid (PrimRep, Id)] -&gt; (Int, Int, [(NonVoid Id, Int)]))
-&gt; ([Id] -&gt; [NonVoid (PrimRep, Id)])
-&gt; [Id]
-&gt; (Int, Int, [(NonVoid Id, Int)])
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid Id] -&gt; [NonVoid (PrimRep, Id)]
</span><a href="GHC.StgToCmm.Closure.html#addIdReps"><span class="hs-identifier hs-var">StgToCmm.Closure.addIdReps</span></a></span><span>
</span><span id="line-497"></span><span>      </span><span class="annot"><span class="annottext">([NonVoid Id] -&gt; [NonVoid (PrimRep, Id)])
-&gt; ([Id] -&gt; [NonVoid Id]) -&gt; [Id] -&gt; [NonVoid (PrimRep, Id)]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [NonVoid Id]
</span><a href="GHC.StgToCmm.Closure.html#nonVoidIds"><span class="hs-identifier hs-var">StgToCmm.Closure.nonVoidIds</span></a></span><span>
</span><span id="line-498"></span><span>      </span><span class="annot"><span class="annottext">([Id] -&gt; (Int, Int, [(NonVoid Id, Int)]))
-&gt; [Id] -&gt; (Int, Int, [(NonVoid Id, Int)])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053569"><span class="hs-identifier hs-var">ids</span></a></span><span>
</span><span id="line-499"></span><span>
</span><span id="line-500"></span><span class="hs-comment">-- | The number of words a single 'Id' adds to a closure's size.</span><span>
</span><span id="line-501"></span><span class="hs-comment">-- Note that this can't handle unboxed tuples (which may still be present in</span><span>
</span><span id="line-502"></span><span class="hs-comment">-- let-no-escapes, even after Unarise), in which case</span><span>
</span><span id="line-503"></span><span class="hs-comment">-- @'GHC.StgToCmm.Closure.idPrimRep'@ will crash.</span><span>
</span><span id="line-504"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#idClosureFootprint"><span class="hs-identifier hs-type">idClosureFootprint</span></a></span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span>
</span><span id="line-505"></span><span id="idClosureFootprint"><span class="annot"><span class="annottext">idClosureFootprint :: Platform -&gt; Id -&gt; Int
</span><a href="GHC.Stg.Lift.Analysis.html#idClosureFootprint"><span class="hs-identifier hs-var hs-var">idClosureFootprint</span></a></span></span><span> </span><span id="local-6989586621681053563"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053563"><span class="hs-identifier hs-var">platform</span></a></span></span><span>
</span><span id="line-506"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; ArgRep -&gt; Int
</span><a href="GHC.StgToCmm.ArgRep.html#argRepSizeW"><span class="hs-identifier hs-var">StgToCmm.ArgRep.argRepSizeW</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053563"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-507"></span><span>  </span><span class="annot"><span class="annottext">(ArgRep -&gt; Int) -&gt; (Id -&gt; ArgRep) -&gt; Id -&gt; Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#idArgRep"><span class="hs-identifier hs-var">StgToCmm.ArgRep.idArgRep</span></a></span><span>
</span><span id="line-508"></span><span>
</span><span id="line-509"></span><span class="hs-comment">-- | @closureGrowth expander sizer f fvs@ computes the closure growth in words</span><span>
</span><span id="line-510"></span><span class="hs-comment">-- as a result of lifting @f@ to top-level. If there was any growing closure</span><span>
</span><span id="line-511"></span><span class="hs-comment">-- under a multi-shot lambda, the result will be 'infinity'.</span><span>
</span><span id="line-512"></span><span class="hs-comment">-- Also see &quot;GHC.Stg.Lift.Analysis#clogro&quot;.</span><span>
</span><span id="line-513"></span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#closureGrowth"><span class="hs-identifier hs-type">closureGrowth</span></a></span><span>
</span><span id="line-514"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-515"></span><span>  </span><span class="hs-comment">-- ^ Expands outer free ids that were lifted to their free vars</span><span>
</span><span id="line-516"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span>
</span><span id="line-517"></span><span>  </span><span class="hs-comment">-- ^ Computes the closure footprint of an identifier</span><span>
</span><span id="line-518"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span>
</span><span id="line-519"></span><span>  </span><span class="hs-comment">-- ^ Binding group for which lifting is to be decided</span><span>
</span><span id="line-520"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DIdSet"><span class="hs-identifier hs-type">DIdSet</span></a></span><span>
</span><span id="line-521"></span><span>  </span><span class="hs-comment">-- ^ Free vars of the whole binding group prior to lifting it. These must be</span><span>
</span><span id="line-522"></span><span>  </span><span class="hs-comment">--   available at call sites if we decide to lift the binding group.</span><span>
</span><span id="line-523"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#Skeleton"><span class="hs-identifier hs-type">Skeleton</span></a></span><span>
</span><span id="line-524"></span><span>  </span><span class="hs-comment">-- ^ Abstraction of the scope of the function</span><span>
</span><span id="line-525"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#IntWithInf"><span class="hs-identifier hs-type">IntWithInf</span></a></span><span>
</span><span id="line-526"></span><span>  </span><span class="hs-comment">-- ^ Closure growth. 'infinity' indicates there was growth under a</span><span>
</span><span id="line-527"></span><span>  </span><span class="hs-comment">--   (multi-shot) lambda.</span><span>
</span><span id="line-528"></span><span id="closureGrowth"><span class="annot"><span class="annottext">closureGrowth :: (DIdSet -&gt; DIdSet)
-&gt; (Id -&gt; Int) -&gt; IdSet -&gt; DIdSet -&gt; Skeleton -&gt; IntWithInf
</span><a href="GHC.Stg.Lift.Analysis.html#closureGrowth"><span class="hs-identifier hs-var hs-var">closureGrowth</span></a></span></span><span> </span><span id="local-6989586621681053560"><span class="annot"><span class="annottext">DIdSet -&gt; DIdSet
</span><a href="#local-6989586621681053560"><span class="hs-identifier hs-var">expander</span></a></span></span><span> </span><span id="local-6989586621681053559"><span class="annot"><span class="annottext">Id -&gt; Int
</span><a href="#local-6989586621681053559"><span class="hs-identifier hs-var">sizer</span></a></span></span><span> </span><span id="local-6989586621681053558"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053558"><span class="hs-identifier hs-var">group</span></a></span></span><span> </span><span id="local-6989586621681053557"><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053557"><span class="hs-identifier hs-var">abs_ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; IntWithInf
</span><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-529"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-530"></span><span>    </span><span id="local-6989586621681053556"><span class="annot"><span class="annottext">go :: Skeleton -&gt; IntWithInf
</span><a href="#local-6989586621681053556"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="GHC.Stg.Lift.Analysis.html#NilSk"><span class="hs-identifier hs-var">NilSk</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><span class="hs-number">0</span></span><span>
</span><span id="line-531"></span><span>    </span><span class="annot"><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#BothSk"><span class="hs-identifier hs-type">BothSk</span></a></span><span> </span><span id="local-6989586621681053555"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053555"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681053554"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053554"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; IntWithInf
</span><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053555"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">IntWithInf -&gt; IntWithInf -&gt; IntWithInf
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; IntWithInf
</span><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053554"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-532"></span><span>    </span><span class="annot"><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#AltSk"><span class="hs-identifier hs-type">AltSk</span></a></span><span> </span><span id="local-6989586621681053553"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053553"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681053552"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053552"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntWithInf -&gt; IntWithInf -&gt; IntWithInf
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">max</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton -&gt; IntWithInf
</span><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053553"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Skeleton -&gt; IntWithInf
</span><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053552"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-533"></span><span>    </span><span class="annot"><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#ClosureSk"><span class="hs-identifier hs-type">ClosureSk</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681053550"><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053550"><span class="hs-identifier hs-var">clo_fvs</span></a></span></span><span> </span><span id="local-6989586621681053549"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053549"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-534"></span><span>      </span><span class="hs-comment">-- If no binder of the @group@ occurs free in the closure, the lifting</span><span>
</span><span id="line-535"></span><span>      </span><span class="hs-comment">-- won't have any effect on it and we can omit the recursive call.</span><span>
</span><span id="line-536"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053548"><span class="hs-identifier hs-var">n_occs</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><span class="hs-number">0</span></span><span>
</span><span id="line-537"></span><span>      </span><span class="hs-comment">-- Otherwise, we account the cost of allocating the closure and add it to</span><span>
</span><span id="line-538"></span><span>      </span><span class="hs-comment">-- the closure growth of its RHS.</span><span>
</span><span id="line-539"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IntWithInf
</span><a href="GHC.Types.Basic.html#mkIntWithInf"><span class="hs-identifier hs-var">mkIntWithInf</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053547"><span class="hs-identifier hs-var">cost</span></a></span><span> </span><span class="annot"><span class="annottext">IntWithInf -&gt; IntWithInf -&gt; IntWithInf
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; IntWithInf
</span><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053549"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-540"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-541"></span><span>        </span><span id="local-6989586621681053548"><span class="annot"><span class="annottext">n_occs :: Int
</span><a href="#local-6989586621681053548"><span class="hs-identifier hs-var hs-var">n_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; Int
</span><a href="GHC.Types.Var.Set.html#sizeDVarSet"><span class="hs-identifier hs-var">sizeDVarSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053545"><span class="hs-identifier hs-var">clo_fvs'</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; IdSet -&gt; DIdSet
</span><a href="GHC.Types.Var.Set.html#dVarSetIntersectVarSet"><span class="hs-operator hs-var">`dVarSetIntersectVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621681053558"><span class="hs-identifier hs-var">group</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-542"></span><span>        </span><span class="hs-comment">-- What we close over considering prior lifting decisions</span><span>
</span><span id="line-543"></span><span>        </span><span id="local-6989586621681053545"><span class="annot"><span class="annottext">clo_fvs' :: DIdSet
</span><a href="#local-6989586621681053545"><span class="hs-identifier hs-var hs-var">clo_fvs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; DIdSet
</span><a href="#local-6989586621681053560"><span class="hs-identifier hs-var">expander</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053550"><span class="hs-identifier hs-var">clo_fvs</span></a></span><span>
</span><span id="line-544"></span><span>        </span><span class="hs-comment">-- Variables that would additionally occur free in the closure body if</span><span>
</span><span id="line-545"></span><span>        </span><span class="hs-comment">-- we lift @f@</span><span>
</span><span id="line-546"></span><span>        </span><span id="local-6989586621681053543"><span class="annot"><span class="annottext">newbies :: DIdSet
</span><a href="#local-6989586621681053543"><span class="hs-identifier hs-var hs-var">newbies</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053557"><span class="hs-identifier hs-var">abs_ids</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet -&gt; DIdSet -&gt; DIdSet
</span><a href="GHC.Types.Var.Set.html#minusDVarSet"><span class="hs-operator hs-var">`minusDVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053545"><span class="hs-identifier hs-var">clo_fvs'</span></a></span><span>
</span><span id="line-547"></span><span>        </span><span class="hs-comment">-- Lifting @f@ removes @f@ from the closure but adds all @newbies@</span><span>
</span><span id="line-548"></span><span>        </span><span id="local-6989586621681053547"><span class="annot"><span class="annottext">cost :: Int
</span><a href="#local-6989586621681053547"><span class="hs-identifier hs-var hs-var">cost</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Int -&gt; Int) -&gt; Int -&gt; DIdSet -&gt; Int
forall a. (Id -&gt; a -&gt; a) -&gt; a -&gt; DIdSet -&gt; a
</span><a href="GHC.Types.Var.Set.html#nonDetStrictFoldDVarSet"><span class="hs-identifier hs-var">nonDetStrictFoldDVarSet</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681053540"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053540"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621681053539"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053539"><span class="hs-identifier hs-var">size</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Int
</span><a href="#local-6989586621681053559"><span class="hs-identifier hs-var">sizer</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681053540"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053539"><span class="hs-identifier hs-var">size</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">DIdSet
</span><a href="#local-6989586621681053543"><span class="hs-identifier hs-var">newbies</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053548"><span class="hs-identifier hs-var">n_occs</span></a></span><span>
</span><span id="line-549"></span><span>        </span><span class="hs-comment">-- Using a non-deterministic fold is OK here because addition is commutative.</span><span>
</span><span id="line-550"></span><span>    </span><span class="annot"><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Lift.Analysis.html#RhsSk"><span class="hs-identifier hs-type">RhsSk</span></a></span><span> </span><span id="local-6989586621681053538"><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053538"><span class="hs-identifier hs-var">body_dmd</span></a></span></span><span> </span><span id="local-6989586621681053537"><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053537"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-551"></span><span>      </span><span class="hs-comment">-- The conservative assumption would be that</span><span>
</span><span id="line-552"></span><span>      </span><span class="hs-comment">--   1. Every RHS with positive growth would be called multiple times,</span><span>
</span><span id="line-553"></span><span>      </span><span class="hs-comment">--      modulo thunks.</span><span>
</span><span id="line-554"></span><span>      </span><span class="hs-comment">--   2. Every RHS with negative growth wouldn't be called at all.</span><span>
</span><span id="line-555"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-556"></span><span>      </span><span class="hs-comment">-- In the first case, we'd have to return 'infinity', while in the</span><span>
</span><span id="line-557"></span><span>      </span><span class="hs-comment">-- second case, we'd have to return 0. But we can do far better</span><span>
</span><span id="line-558"></span><span>      </span><span class="hs-comment">-- considering information from the demand analyser, which provides us</span><span>
</span><span id="line-559"></span><span>      </span><span class="hs-comment">-- with conservative estimates on minimum and maximum evaluation</span><span>
</span><span id="line-560"></span><span>      </span><span class="hs-comment">-- cardinality. The @body_dmd@ part of 'RhsSk' is the result of</span><span>
</span><span id="line-561"></span><span>      </span><span class="hs-comment">-- 'rhsDmdShell' and accurately captures the cardinality of the RHSs body</span><span>
</span><span id="line-562"></span><span>      </span><span class="hs-comment">-- relative to its defining context.</span><span>
</span><span id="line-563"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier hs-var">isAbsDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053538"><span class="hs-identifier hs-var">body_dmd</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><span class="hs-number">0</span></span><span>
</span><span id="line-564"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><a href="#local-6989586621681053536"><span class="hs-identifier hs-var">cg</span></a></span><span> </span><span class="annot"><span class="annottext">IntWithInf -&gt; IntWithInf -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><span class="hs-number">0</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isStrictDmd"><span class="hs-identifier hs-var">isStrictDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053538"><span class="hs-identifier hs-var">body_dmd</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><a href="#local-6989586621681053536"><span class="hs-identifier hs-var">cg</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><span class="hs-number">0</span></span><span>
</span><span id="line-565"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedOnce"><span class="hs-identifier hs-var">isUsedOnce</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621681053538"><span class="hs-identifier hs-var">body_dmd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><a href="#local-6989586621681053536"><span class="hs-identifier hs-var">cg</span></a></span><span>
</span><span id="line-566"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntWithInf
</span><a href="GHC.Types.Basic.html#infinity"><span class="hs-identifier hs-var">infinity</span></a></span><span>
</span><span id="line-567"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-568"></span><span>        </span><span id="local-6989586621681053536"><span class="annot"><span class="annottext">cg :: IntWithInf
</span><a href="#local-6989586621681053536"><span class="hs-identifier hs-var hs-var">cg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Skeleton -&gt; IntWithInf
</span><a href="#local-6989586621681053556"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Skeleton
</span><a href="#local-6989586621681053537"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-569"></span></pre></body></html>